I have created a ticket on lighthouse before, and even assigned a patch. Well, I'm not sure if this patch is correct, or it should work some other way. Take a look please: https://rails.lighthouseapp.com/projects/8994/tickets/5854-has_one-through-on-new-record-doesnt-query-for-associated-object
On 22 окт, 21:08, Aaron Patterson <[email protected]> wrote: > On Fri, Oct 22, 2010 at 01:37:43AM -0700, Alexey Ilyichev wrote: > > Hi. > > > I'd like to hear your opinions about the following issue. > > > I set up associations like this: > > class User > > has_one :user_info > > has_many :bank_infos > > end > > > class UserInfo > > belongs_to :user > > end > > > class BankInfo > > belongs_to :user > > has_one :user_info, :through => :user > > end > > > Then given a user with user_info present I build a bank_info: > > bank_info = user.bank_infos.build > > > and I expect bank_info.user_info to equal bank_info.user.user_info, > > however I get nil. The reason I get nil is the condition for loading > > associated object in method load_target: > >http://github.com/rails/rails/blob/master/activerecord/lib/active_rec... > > in line 236 > > > Do you think its reasonable to make bank_info.user_info to load the > > associated object in the case described above? > > It seems reasonable to me. Can you file a ticket in lighthouse and > assign it to me? > > Thanks. > > -- > Aaron Pattersonhttp://tenderlovemaking.com/ > > application_pgp-signature_part > < 1KбПросмотретьЗагрузить -- 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.
