[Nitro] Og and Hash

Emmanuel Piperakis epiperak at softlab.ece.ntua.gr
Mon Aug 29 21:23:29 EDT 2005


Hi, I have a question for the list:

I want to make a relation between 2 classes, eg Unit and Tenant. Normally 
it
would be something like this:
class Unit
has_many :tenants, Tenant
end

class Tenant
belongs_to :unit, Unit
end

but I want to associate the 2 classes using a Date. Each tenant is related
to a Unit with a specific Date. How can this be done? I thougt of Hashes 
but
I am not sure how to combine the has_many, belongs_to directives with the
Hash:

class Unit
has_many :tenants, Tenants
property :leases, Hash(Date, :tenants)
end

The above code is of course wrong but it kind of explains what I want to 
do...

Thanx


Emmanouil Piperakis (epiperak at cs.ntua.gr)
{To explore is Human, to Create is Devine,
  To teach is Primal, to Rule is Sin}



More information about the Nitro-general mailing list