Re: Associations oddity

Kent S. wrote:

This looks very strange, doesn’t it?

What happens is that when you call


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! :slight_smile:

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs