Displaying 1 result from an estimated 1 matches for "related_el".
Did you mean:
related_as
2008 Jan 18
2
has_many :through with self-referencial AND polymorphism
Hello, despite many readings I still don''t understand how to solve my
problem.
I have Publication, Picture, File classes
A Publication can be related (a one way relation, like a www link) with
another Publication, Picture or File
I tried this :
Publication :
has_many :related_elements, :dependent => :destroy, :foreign_key =>
:publication_id
has_many :related, :through => :related_elements, :as => :linked,
:source => :publication
RelatedElement :
belongs_to :publication
And migrate as
create_table :related_elements do |t|
t.integer :linked_id...