Class: LoginEvent

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/login_event.rb

Class Method Summary collapse

Class Method Details

.cities_in_the_last(time_frame = 2.hours) ⇒ Object

attr_accessible :ip_address, :latitude, :longitude attr_accessible :city, :country_code, :region_name



9
10
11
12
13
# File 'app/models/login_event.rb', line 9

def self.cities_in_the_last(time_frame = 2.hours)
  select('DISTINCT login_events.city').
  where('login_events.city IS NOT NULL').
  where('login_events.created_at >= ?', time_frame.ago)
end