我对Rails Device gem很陌生。并试图了解它是如何工作的。
在我的项目中,有Devise :: PasswordsController。
def update
self.resource = resource_class.reset_password_by_token(resource_params)
yield resource if block_given?
if resource.errors.empty?
resource.unlock_access! if unlockable?(resource)
if Devise.sign_in_after_reset_password
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
set_flash_message!(:notice, flash_message)
resource.after_database_authentication
sign_in(resource_name, resource)
else
set_flash_message!(:notice, :updated_not_active)
end
respond_with resource, location: after_resetting_password_path_for(resource)
else
set_minimum_password_length
respond_with resource
end
end
这将把新密码更新到数据库。
在我的服务器日志中。我可以看到UPDATE
SQL查询已执行。
UPDATE `users` SET `reset_password_sent_at` = NULL, `encrypted_password` = 'somevalue......', `reset_password_token` = NULL, `updated_at` = '2020-xx-xx xx:xx:xx' WHERE `users`.`id` = xxx
但是
为什么找不到与之等效的红宝石代码?如resource.update
这样。
对不起,如果我的问题没有道理。如果是这样,请纠正我的误解。
我在哪里可以找到执行SQL的函数?] >>
我对Rails Device gem很陌生。并试图了解它是如何工作的。在我的项目中,有Devise :: PasswordsController。 def更新self.resource = resource_class ....