我在我的应用程序中使用devise invitable:用户使用电子邮件填写表单,在我的数据库中创建用户并向电子邮件地址发送邀请。然后,另一个人可以通过设置密码来确认其帐户。 一切正常,直到受邀用户尝试通过设置密码登录。当他提交表单时,我收到此错误:
未定义的局部变量或方法`this'用于#
这是我的邀请函:
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
这是什么东西?