Rails - 设计 - 在登录后阻止重定向

时间:2014-06-12 16:11:52

标签: ruby-on-rails devise

我也会在登录后使“注册”按钮工作,但是当我点击按钮时它会重定向到根路径。

我认为这是因为过滤器。

RegistrationController代码:

class RegistrationsController < ApplicationController
  prepend_before_filter :require_no_authentication, :only => [ :new, :create, :after_registration ]
  prepend_before_filter :authenticate_scope!, :only => [:edit, :update, :destroy]
  include Devise::Controllers::InternalHelpers

  # GET /resource/sign_up
  def new
    build_resource
    render_with_scope :new
  end
...

注册页面的网址为/ users / sign_up

有什么想法吗?感谢。

1 个答案:

答案 0 :(得分:1)

你是对的。这是因为:require_no_authentication方法而发生的。它确保用户未经过身份验证,并在用户时重定向用户。

我想在你的情况下你可以在过滤之前删除它。