Aliaksey Kandratsenka
2009-Feb-03 07:09 UTC
[request-for-comments] changeset which makes non-collection association readers return target record
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 <alkondratenko@gmail.com> --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---