Reputation: 621
In a Rails 3 application layout i include a partial for flash messages. While this is ok in most cases, there is a view where I would need flash messages appear in another place; is there a way in layouts/application.html.erb to say something like
<%= render 'layout/messages' unless somecondition %>
where somecondition is something able to detect that I am in 'myview/index'?
Upvotes: 0
Views: 533
Reputation: 43825
Sure is, use actually you should use params[:controller]
and params[:action]
controller_name
and action_name
per the Rails documentation
<%= render 'layout/messages'
if controller_name == 'myview' && action_name == 'index' %>
Upvotes: 5