dm-is-countercacheable

Description

A DataMapper plugin for adding counter-cache properties to related models.

Example

Adds counter properties to Post and User for the number of comments:

require 'dm-core'

class Comment

  include DataMapper::Resource

  is :counter_cacheable

  property :id, Serial

  property :body, Text

  belongs_to :post

  belongs_to :user

  counter_cacheable :post
  counter_cacheable :user, :counter_property => :post_comments_counter

end

Requirements

Install

$ sudo gem install dm-is-countercacheable

License

Copyright (c) 2008-2011 Hal Brodigan

See LICENSE for license information.