Hi Ilan,

thank you for your answer:

Ilan Berci wrote:

> class Person < ActiveRecord::Base
> has_many :documents
> has_many :realties
> end
> 
> class Document < ActiveRecord::Base
> belongs_to :owner, class_name => "Person"
> belongs_to :realty
> end
> 
> class Realty < ActiveRecord::Base
> belongs_to :owner, class_name => "Person"
> has_many :leases, class_name => "Document"
> end
> 

Well, this is exacly what I want to avoid. As the project grows, more 
and more classes can be linked to each other. With your approach, each 
class would start with a listing of "hard-wired" associations.

Imagine 10 classes being able to be linked to each other - what a mess 
to maintain in each class!


Instead, I would like something like this:

class Relationship < ActiveRecord::Base
  has_one :the_one   # can be any model
  has_one :the_other # can be any model
end

or, even more flexible

class Relationship < ActiveRecord::Base
  has_many :members  # a list model of any type
end

But how to do this with "the magic" of Rails?

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to