be careful: you're building a ring. that's a complex and so trivial thing.
obvious problem: for a company to store the foreign key of its headquarter the building has to exist. for that building to store the foreign key of the company that it belongs to, the company has to exist. to simplify it, there are a couple of solutions: - you could just use an additional attribute in building "is_headquarter" (bool) <-- your mentioned headquarter flag - you could add an additional model headquarter that has many branches, such that "a company has_one headquarter" and "it has_many branches through headquarter". <-- problem here: hard to upgrade a branch to headquarter and data-redundancy - you could create a polymorphic building with an interface for headquarter and branch http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations imho the last option seems to be the best. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

