There's no built-in functionality for this, but you can just add after_create and before_destroy callbacks to increment/decrement the parent records with the correct count based on any number of conditions.
You can see how it's implemented in the Rails source here: http://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations.rb#L1451 On Tue, Dec 8, 2009 at 10:28 AM, liquid_rails <[email protected]>wrote: > I would like for the database to keep a count of postings belonging to > a specific category (can do that), that are NOT expired (don't know > how to do that). Are there any built-in functions to do this? > > Thanks! > > -- > SD Ruby mailing list > [email protected] > http://groups.google.com/group/sdruby > -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
