Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
DataMapper::CounterCacheable allows you to transparently maintain counts on a collection association for a DataMapper::Resource object.
Ruby
branch: master

This branch is 3 commits ahead of saimonmoore:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
tasks
.gitignore
History.rdoc
LICENSE
Manifest.txt
README.rdoc
Rakefile
TODO

README.rdoc

dm-counter-cache

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

Something went wrong with that request. Please try again.