ruby - Conditionally render partials in application layout -


in rails 3 application layout include partial flash messages. while ok in cases, there view need flash messages appear in place; there way in layouts/application.html.erb

<%= render 'layout/messages' unless somecondition %> 

where somecondition able detect in 'myview/index'?

sure is, use params[:controller] , params[:action] should use controller_name , action_name per rails documentation

<%= render 'layout/messages'    if controller_name == 'myview' && action_name == 'index' %> 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -