In Rails 3, you can pass has attributes directly to redirect_to
to set the flash. For example:
redirect_to root_path, :notice => "Something was successful!"
However, this only works with the :alert
and :notice
keys; if you want to use custom keys, you have to use a more verbose version:
redirect_to root_path, :flash => { :error => "Something was successful!" }
Is there any way to make it so that custom keys (such as :error
, above) can be passed to redirect_to
without specifying it in :flash => {}
?