What Changed in Rails v2.3.6 – redirect_to with flash

RubyOnRails 15 八月 2010 | View Comments

In this commit rails team improved redirect_to method, we can passing flash option directly.

# ... in an action

#old style
flash[:notice] = "Pay attention to the road"
redirect_to post_url(@post)

#new way
redirect_to post_url(@post), :notice => "Pay attention to the road"
They also add some convenient methods for flash object. Now you can get/set flash object in view by alert,alert=(message),notice,notice=(message)


Tagged in , , ,

Ads Plugin created by Jake Ruston's Wordpress Plugins - Powered by and football database.