I came to the solution using the has_many_polymorphs plugins:
The correct modelling is:
class Relationship < ActiveRecord::Base
belongs_to :relationship_owner, :polymorphic => true
belongs_to :relationship_partner, :polymorphic => true
acts_as_double_polymorphic_join(
:relationsh
Dear Ilan,
although I just supplied just three basic models, my application already
contains more than 15 different models that should be linked to each
other.
Some more examples:
- I need a relationship between two documents ("Like: Document B is an
attachment to Document A).
- I need a rel
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
> bel
I have read many articles about polymorphic associations in Rails and
also about plugins for this purpose (mainly the has_many_polymorphs
plugin).
Unfortunately, I am still unsure how to solve my problem:
Let's say you have these models you want to set in relation to each
other: Person, Document
4 matches
Mail list logo