On Feb 11, 2:46 am, Kendall Gifford <[email protected]> wrote:
> On Feb 10, 7:27 pm, Erol Fornoles <[email protected]> wrote:
>
>
> Cool, I didn't know that the evaluated result (Array-like-thingy) of
> an association could in turn be used to access named scopes w/in the
> associated class. Works great.
>
foo.sprockets is a proxy object, which in some cases will just behave
like a named_scope. Proxy extensions have been around for longer and
can also be useful too, but they're not needed as often these days.
Proxy extensions are things like
has_many :sprockets do
def version(version)
find(:all, :conditions => {:version =>version)
end
end
In this case you gain nothing over using the named scope (in fact the
named scope is more useful because you don't have to be going through
the association), but proxy extensions have access to the owner object
of the association (proxy_owner), the reflection object for the
association etc. which can be useful for some purposes
Fred
Fred
--
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.