css - rails3: how to change the <body> color for the views of only one controller? -
in rails3, want have views in specific controller(groups_controller) have different body background color. have stylesheet groups.css rule:
body { background-color:#333}
and i'm including file in application.css. problem every controller gets styles defined in groups.css. there way this? thank you!
check out this section of rails asset pipeline guide 1 way achieve this.
you'll want move style rule stylesheet controller (groups.css.scss
), , make sure each page loads stylesheet associated controller. can adding following line view template (probably application.html.erb
):
<%= stylesheet_link_tag params[:controller] %>
you'll need make sure css manifest doesn't include groups.css.scss
-- if rest of style rules in application.css
, can remove *= require_tree .
directive.
there other ways same thing, if you're not happy approach should able find other alternatives.
Comments
Post a Comment