devise
devise copied to clipboard
NoMethodError when finding user after Rails 7.2 upgrade.
- Ruby 3.2.2
- Rails 7.2.0
- Devise 4.9.4
Following the upgrade, this code from app/models/user.rb:89:in 'find_for_database_authentication'
triggers a NoMethodError:
def self.find_for_database_authentication(warden_conditions)
conditions = warden_conditions.dup
login = conditions[:login]
where(['lower(username) = :value OR lower(email) = :value', { value: login.downcase.strip }]).first if login # NoMethodError thrown here
end
The error:
NoMethodError (undefined method `name' for "john":String):
(i.e. this is the user's username).
Previously I was using Rails 7.1.3.3 and reverting to that fixes this issue (7.1.3.4 is fine as well). I can't upgrade to the latest master of Devise due to also using devise-jwt.
Strangely, this problem only affects the application when running in development mode.