according to Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. 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 Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. 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