Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.65 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. the best way to have separate stylesheets for different actions in Rails
  2. <html>
  3.   <head>
  4.     <%= stylesheet_link_tag 'application' -%>
  5.     <%= javascript_include_tag 'yui', 'application' -%>
  6.   </head>
  7.   <body>
  8.     <%= yield -%>
  9.   </body>
  10. </html>
  11.        
  12. # layouts/application.html.erb
  13. <html>
  14.   <head>
  15.     <%= stylesheet_link_tag 'application' -%>
  16.     <%= javascript_include_tag 'yui', 'application' -%>
  17.     <%= yield :head -%>
  18.   </head>
  19.   <body>
  20.     <%= yield -%>
  21.   </body>
  22. </html>
  23.  
  24. # views/profiles/show.html.erb
  25. <%= title("#{@user.name}'s Profile") -%>
  26.  
  27. <% content_for :head do -%>
  28.   <%= javascript_include_tag 'gallery' %>
  29. <% end %>
  30.  
  31. <%= render @user.photos %>