Ruby on Rails Thursday, December 1, 2011

Is it wrong to use a beings_to on both side of a one-to-one
association ?

User
belongs_to :account so I have an account_id field

Account
belongs_to :owner, :class_name => 'User', :foreign_key => 'user_id'

I can get user.account and account.owner
It runs, but I wonder about any collateral effect...

thanks for your feedback

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

No comments:

Post a Comment