Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (27 sloc) 1.02 KB

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 {file:LICENSE.txt} for license information.