Sha256: 8e80c52199496aa286ed4806b80ae126f0896230b0237be1ebf9ec5d81f94352

Contents?: true

Size: 459 Bytes

Versions: 6

Compression:

Stored size: 459 Bytes

Contents

class LoginEvent < ActiveRecord::Base
  set_table_name 'login_events'

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

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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
devise_password_sharing_extension-0.0.12 app/models/login_event.rb
devise_password_sharing_extension-0.0.11 app/models/login_event.rb
devise_password_sharing_extension-0.0.10 app/models/login_event.rb
devise_password_sharing_extension-0.0.9 app/models/login_event.rb
devise_password_sharing_extension-0.0.8 app/models/login_event.rb
devise_password_sharing_extension-0.0.7 app/models/login_event.rb