rails/rails — pull request #5728 by nickmabry (2012-04-04 05:07:47+00:00)
Title: redirect_to now accepts flash options for controller actions without explicit syntax

This is a minor change, but the syntax for redirecting to controller actions with flash options is more cumbersome than for other redirect targets. Previously, `redirect_to` required explicit parentheses and braces:

# Redirect to url
redirect_to post_url(@post), status: 301
redirect_to post_url(@post), status: 302, notice: "We've temporarily moved!"

# Redirect to controller action
redirect_to action: 'atom', status: 301
redirect_to({action: 'atom'}, status: 302, notice: "We're temporarily moved!")
redirect_to({action: 'atom', status: 302}, notice: "We're temporarily moved!")

To avoid this, we could pull flash options from the action hash, as we currently do for the status option, leaving us with the syntax:

redirect_to action: 'atom', status: 302, notice: "We're temporarily moved!"

This change would be backwards compatible with the exception of anyone using `:notice', ':alert', or ':flash' as action hash keys to provide query string parameters or something.