Ruby on rails 如何设置会话变量来告诉Desive在登录或注册后重定向到哪里?

Ruby on rails 如何设置会话变量来告诉Desive在登录或注册后重定向到哪里?,ruby-on-rails,ruby-on-rails-3,devise,Ruby On Rails,Ruby On Rails 3,Devise,Desive是否内置了一个方法,您可以传递一个包含URL的变量,以便在用户登录或注册后将其重定向到该变量 谢谢如果您的模型名为User,请在config/routes.rb中定义User\u root路由: match '/profile', :to => "user#profile", :as => "user_root" Desive随后将自动将用户重定向到此路径 Wiki中有一个页面解释了这一点:。application\u controller.rb ... def a

Desive是否内置了一个方法,您可以传递一个包含URL的变量,以便在用户登录或注册后将其重定向到该变量


谢谢

如果您的模型名为
User
,请在
config/routes.rb中定义
User\u root
路由:

match '/profile', :to => "user#profile", :as => "user_root"
Desive随后将自动将用户重定向到此路径


Wiki中有一个页面解释了这一点:。

application\u controller.rb

...
  def after_sign_in_path_for(resource_or_scope)
    example_path
  end

  def after_sign_up_path_for(resource_or_scope)
    example_path
  end
...