How to add css to controller view on basis on controller name
I am new to ruby. I want to add css to controller view on basis of controller names. How can i do so because using all css is making difficult for me to change body color and other attributes using css.
Currently, my application.html.erb has :
<%= stylesheet_link_tag "application", :media => "all" %>
to use all css files. How can i customize it to use particular css with particular controller.
Thanks in advance
I use something like this in my ApplicationHelper.
def controller_stylesheet_link_tag return "" if params[:controller].blank? begin stylesheet_link_tag params[:controller].downcase, :media => "all" rescue Exception => e e.message end end
Then, you just call <%=controller_stylesheet_link_tag %> in your layout.