Forum: Ruby on Rails Re: Associations oddity

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Paul B. (Guest)
on 2006-02-05 00:17
(Received via mailing list)
Kent S. wrote:
> This looks very strange, doesn't it?
> What happens is that when you call
> q.category
> you get AssociationProxy object which pretends to be another object.
> After you call

Thanks, Kent.

OK - I understand what's happening. I still think that it violates the
principle of least surprise! :-)

Regarding the second half of my question - is there a better way to
the situation than "dup"?

I notice that AssociationProxy has a "target" method - which does seem
to do
the trick. Is this the best solution - or is there an alternative I
be aware of?

Thanks again!

(BTW - is it just me, or are others having problems with the forum
bridge at
the moment?)


Snetterton, Castle Combe, Cadwell Park...
Who says I have a one track mind?
This topic is locked and can not be replied to.