This shows how to do it too w/o having to read through a lot of code.
I'll try it.  Thanks for you help!

http://douglasfshearer.com/blog/custom-counter_cache-with-conditions

On Dec 8, 2:49 pm, liquid_rails <[email protected]> wrote:
> Both.  I haven't tried to implement it yet.  I just clicked on the
> link you sent and there's lots of code to go through!  I DO think a
> plugin would be useful.  I don't know how to write plugins.  I'm not
> full-time at this.
>
> On Dec 8, 2:43 pm, James Miller <[email protected]> wrote:
>
>
>
>
>
> > Are you still having trouble implementing a custom one?  Or just commenting
> > that it would be helpful?
>
> > Why don't you write one?
>
> > On Tue, Dec 8, 2009 at 2:38 PM, liquid_rails 
> > <[email protected]>wrote:
>
> > > If someone could write a plugin to do custom counter-caches, that
> > > would be Awesome.  I think it would be very useful!
>
> > > On Dec 8, 10:34 am, James Miller <[email protected]> wrote:
> > > > 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_rec...
>
> > > > 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
>
>

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to