Wednesday, October 6, 2010

[Rails] reflect_on_association method

Hi all, I am having trouble trying to use reflect_on_association
method with given the simplified model:

class Order < ActiveRecord::Base
belongs_to :contractor, :class_name => "BusinessUnit"
end

I expected the reflect_on_association method to return
associated_foreign_key "contractor_id" but it returns
"business_unit_id":

ruby-1.9.2-p0 >
Order.reflect_on_association(:contractor).association_foreign_key
=> "business_unit_id"

do I miss something?

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate