DEPRECATION WARNING: find_by_login_method is deprecated in favor of record_selection_method, to avoid confusion with ActiveRecord's "Dynamic Finders". (https://guides.rubyonrails.org/v6.0/active_record_querying.html#dynamic-finders) For example, rubocop-rails is confused by the deprecated method. (https://github.com/rubocop-hq/rubocop-rails/blob/master/lib/rubocop/cop/rails/dynamic_find_by.rb) (called from <class:UserSession> at /Users/manfred/Code/alonetone/app/models/user_session.rb:2)
Replaces with find_by_login_method with record_selection_method when configuring the method in UserSession.
Change User.find_by_login_or_email to use one query to find the user.
Add some tests.
I tested this locally by logging in with login and email. I also made sure you can't login with a black username and valid password.
Rails said:
find_by_login_method
withrecord_selection_method
when configuring the method inUserSession
.User.find_by_login_or_email
to use one query to find the user.I tested this locally by logging in with login and email. I also made sure you can't login with a black username and valid password.