[Rails] Re: Re: Modelling Foreign Keys

Arch Stanton d6veteran at gmail.com
Sat Apr 1 02:12:01 GMT 2006


Chris Hall wrote:
> models:
> 
> class User < ActiveRecord::Base
>   has_many :posts
> end
> 
> class Post < ActiveRecord::Base
>   beongs_to :user #
> end
> 


Thanks Chris.

So, what do I get from explicitly identifying the foreign key 
relationship in the model (like belongs_to :advisor, 
:class_name=>"Advisor", :foreign_key =>
"advisor_id")??

Thanks.

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list