Displaying 1 result from an estimated 1 matches for "a_publication".
2008 Jan 18
2
has_many :through with self-referencial AND polymorphism
...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
t.string :linked_type
t.integer :publication_id
end
When I do
a_publication.related[0] = another_publication
a_publication.save!
I would expect the related_elements table beeing updated with
publication_id = the id of a_publication
linked_id = the id of another_publication
linked_type = the class name ''Publication''
But nothing happen... And I must confe...