What Changed in Rails v2.3.6 – redirect_to with flash

RubyOnRails 15 八月 2010 | View Comments


In this commitgithub.com/rails/rails/commit/e6cadd422b72ba9818cc2f3b22243a6aa754c9f8 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 , , ,

blog comments powered by Disqus

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