【问题标题】:rails devise This webpage has a redirect looprails devise 这个网页有一个重定向循环
【发布时间】:2014-04-30 16:08:56
【问题描述】:

我使用了以下路线

  devise_for :users, path: '', path_names: { sign_in: 'login', sign_out: 'logout', registration: 'signup', sign_up: 'signup'}

  devise_scope :user do
    root to: 'devise/registrations#new'
    get 'signup', to: 'devise/registrations#new'
  end

如上所述,当我运行 localhost:3000 时,它将显示注册页面。但是,一旦我使用 devise gem 登录/注册,它会再次重定向回根路径,从而导致以下重定向循环如何自定义 devise 以在登录后重定向特定页面。

【问题讨论】:

    标签: ruby-on-rails devise


    【解决方案1】:

    使用 devise 有多种方法可以做到这一点,the devise wiki 列出了大约十种左右。

    设计 wiki 上的这个页面应该有帮助:How To: redirect to a specific page on successful sign in

    这个页面也应该有帮助How To: Redirect to a specific page on successful sign in and sign out

    我还使用了此 wiki 页面上详述的解决方案:How To: Redirect back to current page after sign in, sign out, sign up, update

    【讨论】:

      猜你喜欢
      • 2013-11-10
      • 2014-12-27
      • 2013-06-10
      • 2013-12-22
      • 2013-11-06
      • 2013-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多