Repository is archived
No commit activity in last 3 years
No release in over 3 years
A DataMapper plugin for adding counter-cache properties to related models.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 0.6.0

Runtime

~> 1.0
 Project Readme

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.