Hi.

I've just posted the ticket with patch which makes association readers
return target record instead of association proxy.

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1855-patch-return-associated-records-not-proxies-from-readers-of-non-collection-associations

The logic behind the change is that we are already loading proxy target
immediately after creating proxy. This is needed because we must return
nil if target record does not exists (for if/unless operators). And
because we always have target record or nil why not just return them ?

The change is slight change of API, as can be seen by count of tests I
had to adjust (not 0, but still small). To give people access to
association proxies, I've added new public method:
#association_proxy(name, force_reload=false), which returns proxy object
without trying to load it's target.

What's the general public's opinion on this change?

If this change will be accepted, non-collection associations proxies
will not proxy anything anymore. But this can be cleaned up later.

-- 
Aliaksey Kandratsenka <[email protected]>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to