Skip to content
A DataMapper plugin for adding counter-cache properties to related models.
Ruby
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.yardopts
ChangeLog.md
Gemfile
LICENSE.txt
README.md
Rakefile
dm-is-counter_cacheable.gemspec
gemspec.yml

README.md

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

See {file:LICENSE.txt} for license information.

Something went wrong with that request. Please try again.