Reputation: 8827
i have a footer as the last element in my application.html.erb page, however for one page in the whole site, i do not want the footer to appear.
Whats the best way to handle this? every solution i come up with is wet (not dry)
Upvotes: 2
Views: 6888
Reputation: 115541
Why don't you create a specific layout for this single page? It should be more maintainable than any extra logic.
DRY is not a goal to reach, it's like a conditional warning and like all warnings, you can ignore them if it makes sense.
If you really insist, do this:
<% unless defined? @no_footer %>
your html here
<% end %>
So the footer will disappear only if you set the instance variable in your controller:
@no_footer = true
Another way could be to check params action/controller and put the logic in a helper method.
Upvotes: 10