Module: ActAsCached::ActiveRecord::FinderMethods
- Defined in:
- lib/act_as_cached/active_record/finder_methods.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cache_mod ⇒ Object
-
#find_with_act_as_cached(*args) ⇒ Object
Only support find with primary_key are currently supported.
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/act_as_cached/active_record/finder_methods.rb', line 4 def self.included(base) base.class_eval do alias_method_chain :find,:act_as_cached end end |
Instance Method Details
#cache_mod ⇒ Object
23 24 25 |
# File 'lib/act_as_cached/active_record/finder_methods.rb', line 23 def cache_mod klass.cache_mod end |
#find_with_act_as_cached(*args) ⇒ Object
Only support find with primary_key are currently supported.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/act_as_cached/active_record/finder_methods.rb', line 11 def find_with_act_as_cached(*args) = args. if args.length == 1 && enabled_cache? && where_values.blank? # TODO path = [cache_mod.name,args[0]].join('/') cache_mod.fetch_cache(path) { find_without_act_as_cached(args[0]) } else args << find_without_act_as_cached(*args) end end |