Skip to content

DataMapper::CounterCacheable allows you to transparently maintain counts on a collection association for a DataMapper::Resource object.

License

Notifications You must be signed in to change notification settings

PaddyMou/dm-counter-cache

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

== README

DataMapper::CounterCacheable automates the dec/incrementing of association counter fields. This is
similar to counter caches in ActiveRecord.

Example:

class Post
  include DataMapper::Resource

  has n :comments

  property :id, Integer, :serial => true
  property :comments_count, Integer, :default => 0
end

class Comment
  include DataMapper::Resource
  include DataMapper::CounterCacheable  

  belongs_to :post, :counter_cache => true

end

About

DataMapper::CounterCacheable allows you to transparently maintain counts on a collection association for a DataMapper::Resource object.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published