Module: Devise::Models::Sociable::ClassMethods
- Defined in:
- lib/devise_sociable/model.rb
Constant Summary collapse
- @@actives_cache =
{}
Instance Method Summary collapse
- #actives(last_access) ⇒ Object
- #actives_cache ⇒ Object
- #cache_actives(last_access) ⇒ Object
- #cached?(user) ⇒ Boolean
- #remove_from_cache(user) ⇒ Object
- #uses_cookies? ⇒ Boolean
Instance Method Details
#actives(last_access) ⇒ Object
25 26 27 28 |
# File 'lib/devise_sociable/model.rb', line 25 def actives(last_access) last_access = last_access.ago if last_access.is_a? Fixnum ? (last_access) : actives_server(last_access) end |
#actives_cache ⇒ Object
50 51 52 |
# File 'lib/devise_sociable/model.rb', line 50 def actives_cache @@actives_cache end |
#cache_actives(last_access) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/devise_sociable/model.rb', line 34 def cache_actives(last_access) actives = {} self.actives(last_access).each do |user| actives[user.id] = user end @@actives_cache = actives end |
#cached?(user) ⇒ Boolean
30 31 32 |
# File 'lib/devise_sociable/model.rb', line 30 def cached?(user) @@actives_cache[user.id].present? end |
#remove_from_cache(user) ⇒ Object
42 43 44 |
# File 'lib/devise_sociable/model.rb', line 42 def remove_from_cache(user) @@actives_cache.delete(user.id) end |
#uses_cookies? ⇒ Boolean
46 47 48 |
# File 'lib/devise_sociable/model.rb', line 46 def session_store == ActionDispatch::Session::CookieStore end |