On Tue, Nov 03, 2009 at 02:06:32PM -0800, Frederick Cheung wrote:

> Your associations are back to front - users has a contact_id column,
> so user belongs_to contact, not has_one (ditto contacts and
> address_id)

Thanks, that fixed it. I think my difficulty is that, while has_many
generally makes sense semantically, belongs_to doesn't always. As long
as I think of it as "has_foreign_key_for" instead, it all works out
fine.

For example, in my case a contact has a foreign key to an address. The
address "belongs to" the contact (not the other way around), but I need
to use belongs_to in the model to build the proper relationship.

Thanks again for the help.

-- 
"Oh, look: rocks!"
        -- Doctor Who, "Destiny of the Daleks"


--~--~---------~--~----~------------~-------~--~----~
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 [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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to