Module: DataMapper::CounterCacheable
- Included in:
- Comment
- Defined in:
- lib/dm-counter-cache.rb,
lib/dm-counter-cache/version.rb
Overview
CounterCacheable allows you to transparently maintain counts on collection association of this model on the parent model. You can also specify a custom counter cache column by providing a column name instead of a true/false value to this option (e.g., :counter_cache => :my_custom_counter.)
Defined Under Namespace
Modules: ClassMethods, InstanceMethods, ModelClassMethods
Constant Summary collapse
- VERSION =
'0.9.12.1'
Class Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/dm-counter-cache.rb', line 7 def self.included(klass) DataMapper::Associations::ManyToOne.module_eval do extend DataMapper::CounterCacheable::ClassMethods (class << self; self; end).class_eval do unless method_defined?(:setup_without_counter_caching) alias_method :setup_without_counter_caching, :setup alias_method :setup, :setup_with_counter_caching end end end end |