Named routine alternative to redirect_to

according to http://www.rubyonrails.org/deprecation redirect_to is
deprecated. My logs say that “Instead you should use the named route
directly,”
But if i have an action such as

def action
end

i thought that calling redirect_to :action is different from just
action(). redirect_to :action actually sends a 302 redirect while
action() just executes the method. Am I wrong? Any thoughts?
Thanks

–Andrei

andreim wrote:

according to http://www.rubyonrails.org/deprecation redirect_to is
deprecated. My logs say that "Instead you should use the named route

from the doc:
redirect_to_path, redirect_to_url.
Use redirect_to.

it says redirect_to_path and _url are deprecated, not redirect_to
itself.

Named routes are routes you give a name to in config/routes.rb.

i.e. map.actionname ‘/actionurl’, :controller => ‘mycontroller’, :action
=> ‘myaction’

you can then redirect_to it by:
redirect_to actionname_url

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs