I agree with Ar that you simply need a join table to hold the
relationship from the Company to its Headquarters instead of using an
object hierarchy and inheritance. Using Modules to insert and

class Company
  company_id
end

class Building
  building_id
end

class CompanyHeadquarters
  company_id
  building_id
end

Having the CompanyHeadquarters object may come in handy if you need
extra information about the Headquarters building that is different
from a normal building.

On Jan 19, 9:44 am, Ar Chron <[email protected]> wrote:
> > I think it's a good idea to differentiate headquarters and building
> > using another model (did I get this right?)

> That depends... is there something substantively different about a
> building that is designated as the headquarters? I.e., are you
> maintaining additional data that is specific to a "headquarters"?
>
> So if companies can have space in multiple buildings, and a single
> building can house space for multiple companies, you need a join table
> that represents company-building combinations (officespaces?), and it
> seems that this join entity is what you would need to designate as a
> headquarters or not.


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