For example, all pages need my Footer partial, but the home-page has a couple words that need to be different, and Page Y has one minor alteration too.
Asked
Active
Viewed 133 times
1 Answers
1
You could check the controller and action name:
<% if controller.controller_name == 'Projects' && controller.action_name == 'index' %>
<p>Alternate content</p>
<% end %>
Alternatively, you could pass in a different local variables to the partial from the page(s) in question:
<%= render 'my_partial', :do_something_wierd => true %>
then, in 'my_partial':
<% if do_something_wierd %>
<p>Alternate content</p>
<% end %>

Isak
- 1,591
- 1
- 17
- 23