I have a landing page and chapter1 page. The landing view is linked to one stylesheet. The chapter1 view is linked to another stylesheet. When I go to the home page the correct CSS is applied but when I click to my next page, the CSS form the landing view is being applied to the chapter1 view. When I refresh the chapter1 view, the correct CSS is applied but then when I click back to the home page, the chapter1 CSS is being applied to the landing view. I suspect my pages are rendering both stylesheets. How do I prevent this? How do I select which stylesheets are rendered for the views?
app/views/layouts/application.html.erb <!DOCTYPE html> <html> <head> <title>OrgoDojo</title> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= yield(:head) %> <%= yield(:chapters) %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <%= yield %> <%= render 'layouts/footer_below' %> </body> </html> app/views/pages/chapter1.html.erb <% content_for(:chapters) do %> <%= stylesheet_link_tag 'chapters' , :media => "all" %> <% end %> <%= render 'pages/chapters_header' %> <h1> This is chapter 1</h1> <p> Hello Hello </p> app/views/pages/home.html.erb <% content_for(:head) do %> <%= stylesheet_link_tag 'custom' , :media => "all" %> <% end %> <%= render 'layouts/header' %> <%= render 'layouts/welcome_section' %> <%= render 'layouts/benefits_section' %> <%= render 'layouts/footer_above' %> -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5bbc2d3f-94ed-4c64-a17e-a1ecdb8602dc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.