On May 30, 6:38 pm, Jonathan Rochkind <rails-mailing-l...@andreas-
s.net> wrote:
> Conrad Taylor wrote:
> > An Array instance can respond to both count and size methods. If you
> > use
> > size the method with a counter
> > cache column on the has_many side, you can cache the total.
>
> You can't possibly mean an Array, because an Array doesn't know anything
> about going to databases or cacheing. An Array is just a list of stuff.
>
> You might mean an ActiveRecord Association collection object, which
> behaves a lot like an array, but also has some 'magic' ActiveRecord
> behavior on it.
>
> The fact that, as far as I know, there's no actual class name for this
> AR association magic collection object, makes things rather confusing, I
> agree. I think it's just some proxy methods singleton-added to an Array,
> leaving us without a good name to call what it is, making things
> confusing. Or if it really is a class, I don't know what it's called
> cause it's not mentioned in the docs. This is a kind of a-bit-too-clever
> ruby hacking that Rails, IMHO, uses sometimes when it doesn't really
> have to, making things somewhat more confusing than they need to be.
The classes in question are the various subclasses of
ActiveRecord::AssociationCollection (eg HasManyAssociation)
Fred
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---