0

我在我的应用程序中使用了可邀请的设计:用户用电子邮件填写表格,在我的数据库中创建一个用户并向电子邮件地址发送邀请。然后,其他人可以通过设置他的密码来确认其帐户。一切正常,直到受邀用户尝试通过设置密码登录。当他提交表单时,我收到此错误:

未定义的局部变量或方法 `this' for #

这是我的邀请控制器:

    class Users::InvitationsController < Devise::InvitationsController
  def new
    @user = User.new
  end

  def create
    @user = User.new
    @user.save
  end

  def update
    if this
      redirect_to root_path
    else
      super
    end
  end

  private

  # this is called when creating invitation
  # should return an instance of resource class
  def invite_resource
    ## skip sending emails on invite
    resource_class.invite!(invite_params, current_inviter) do |u|
      u.skip_invitation = true
    end
  end

  # this is called when accepting invitation
  # should return an instance of resource class
  def accept_resource
    resource = resource_class.accept_invitation!(update_resource_params)
    ## Report accepting invitation to analytics
    Analytics.report('invite.accept', resource.id)
    resource
  end
end

这个“这个”是什么东西?

4

0 回答 0