0
我使用"gem 'devise', '~> 4.2'"
,我需要得到current_user与一些auth_token,但方法"User.find_by_authentication_token"
被删除。我可以使用什么方法,或者我怎样才能获得当前用户。我使用json api。我如何获得用户,如果我有auth_token
我使用"gem 'devise', '~> 4.2'"
,我需要得到current_user与一些auth_token,但方法"User.find_by_authentication_token"
被删除。我可以使用什么方法,或者我怎样才能获得当前用户。我使用json api。我如何获得用户,如果我有auth_token
尝试:
User.find_by(authentication_token: "abcd1234")
未被设计提供,但导轨(更具体的ActiveRecord)。文档here。
动态find_by_attribute_name
方法已从ActiveRecord中删除。
@SantoshSharma ty man。这真的帮我:) –