Displaying 2 results from an estimated 2 matches for "reference_item_id".
2006 Apr 09
4
Inheritance via Though Associations?
...n :event_id, :integer
end
create_table :contributors do |t|
t.column :type, :string, :default => "Person"
t.column :sort_name, :string, :limit => 255, :null => false
end
create_table :contributions do |t|
t.column :reference_item_id, :integer
t.column :agent_id, :integer
t.column :type, :string
t.column :position, :integer
end
Drawing on this article ...
<http://blog.hasmanythrough.com/articles/2006/02/28/association-goodness>
... I have no problem using the through...
2006 Apr 02
0
STI and through
...quot; varchar(20),
"sort_name" varchar(255),
"description" text
);
So I''ve got ReferenceItem and Agent classes, each of which has subclasses (for
the first, stuff like Book, Article, etc.).
The third key table links the above:
CREATE TABLE contributors (
"reference_item_id" integer,
"agent_id" integer,
"position" integer,
"type" varchar(20)
);
The Contributor class currently has four subclasses: Author, Editor, Publisher,
and Translator. So the idea is I need to be able to separely track the type and
order of each class.
So...