Multiple polymorphism ?

Hello all,

Let me explain a fairly complex problem, I am blocked
and if someone could give me a boost I can thank him
enough!

The concept:

Maybe I'm missing something, but it doesn't sound like you need
acts_as_taggable or single table inheritance. I think you will get the
desired result by setting up the ObjectRelations model as follows:

class ObjectRelations < ActiveRecord::Base
  belongs_to :linkfrom, :polymorphic => true
  belongs_to :linkto, :polymorphic => true
end

class User < ActiveRecord::Base
  has_many :objectrelations, :as => :linkto
  has_many :objectrelations, :as => :linkfrom
end

Andrew Bloom wrote:

Maybe I'm missing something, but it doesn't sound like you need
acts_as_taggable or single table inheritance. I think you will get the
desired result by setting up the ObjectRelations model as follows:

class ObjectRelations < ActiveRecord::Base
  belongs_to :linkfrom, :polymorphic => true
  belongs_to :linkto, :polymorphic => true
end

class User < ActiveRecord::Base
  has_many :objectrelations, :as => :linkto
  has_many :objectrelations, :as => :linkfrom
end

On Dec 8, 5:39�am, Vincenzo Ruggiero <rails-mailing-l...@andreas-

Agreed...

http://wiki.rubyonrails.org/rails/pages/ManytoManyPolymorphicAssociations