My goal is simple, I just want to know the best approach on how to to do this.
Scenario
book_controller
def new
@book = "book"
end
magazine_controller
def new
@magazine = "magazine"
end
HTML
application.html.erb
<body>
<div class="container">
<body of controller>
</div>
</body>
books/new.html.erb
<h1>hello book</h1>
magazines/new.html.erb
<h1>hello magazine</h1>
css
.background-black {
background: black
}
My goal is to add the background-black CSS class to the only book_controller
for example
<div class="container background-black">
But it will affect magazine_controller
as well. What if I have 4 controllers that needed the black background and the rest don't need that class. What is the best approach?