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_record/associations/association_proxy.rb#L223
in line 236

Do you think its reasonable to make bank_info.user_info to load the
associated object in the case described above?

-- 
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