On 22 February 2011 21:23, James Byrne <li...@ruby-forum.com> wrote: > Colin Law wrote in post #983199: > >> >> Perhaps you need :foreign_key here also. >> >> Colin > > I will try this if I ever go back to that idiom. Based on your > suggestion I discover that this parameter is required only for the > belongs_to method. The API documentation does not give an explicit > example of this usage early up in the introduction where I think it > might be very helpful.
Sometimes you need it on the has_many association also. So if Foo has_many :bars and the key in bars is not foo_id then you will need Foo has_many :bars, :foreign_key => 'whatever_id' In your case if the key is ca_customs_shipment_id then you should not need it on the has_many. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.