diff options
Diffstat (limited to 'app/models/authentication_event.rb')
-rw-r--r-- | app/models/authentication_event.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/authentication_event.rb b/app/models/authentication_event.rb index d5a5079acd6..a70ebb42008 100644 --- a/app/models/authentication_event.rb +++ b/app/models/authentication_event.rb @@ -30,4 +30,8 @@ class AuthenticationEvent < ApplicationRecord !where(user_id: user).exists? || where(user_id: user, ip_address: ip_address).success.exists? end + + def self.most_used_ip_address_for_user(user) + select('mode() within group (order by ip_address) as ip_address').find_by(user: user).ip_address + end end |