Commit 17e821cc

mo khan <mo@mokhan.ca>
2014-10-01 03:35:02
eager load location.
1 parent b7148be
Changed files (1)
app/models/user_session.rb
@@ -3,7 +3,7 @@ class UserSession < ActiveRecord::Base
   has_one :location, as: :locatable
   before_create :set_unique_key
   attr_readonly :key
-  scope :active, -> { where("accessed_at >= ?", 2.weeks.ago).where(revoked_at: nil).includes(:user) }
+  scope :active, -> { where("accessed_at >= ?", 2.weeks.ago).where(revoked_at: nil).includes(:user, :location) }
 
   def revoke!
     self.revoked_at = Time.now