Hello, first off sorry i am new and a dumbass but I need help with this. In my view/application file i have some css and I want a certain bit of css displayed if a user is in one controller but another type of css to be display if they are in another controller. I made up the following which totally doesnt work. <% if :controller => ''pages'', :action => ''index'' , :action => ''about'' %> <div id=''home''></div> <% else %> <div id=''other''></div> <% end %> If you know of a way to make this work so that certain css is displayed when a user is on the home page and about page, but then the css changes when they are on any other page I would greatly appreciate it. Thanks in advance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dan Paul wrote:> Hello, first off sorry i am new and a dumbass but I need help with > this. > > In my view/application file i have some css and I want a certain bit > of css displayed if a user is in one controller but another type of > css to be display if they are in another controller. I made up the > following which totally doesnt work.Why not create a layout for each controller? That way you don''t need the if statements at all, you can just have the layout use whatever layout ue specify. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yeah I guess I can do that, but its just I didn''t want to have to create a new layout just for one simple line of code. But thanks for the suggestion if I cant find a way to do it I will do it that way. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
found the answer if anyone else is looking for it <% if controller.controller_name == "pages" %> <div id=''home''></div> <% else %> <div id=''other''></div> <% end %> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---