search for: model_type_id

Displaying 1 result from an estimated 1 matches for "model_type_id".

2006 Aug 16
1
Creating a comments system for multiple types of content
...My idea is something like having another attribute in the comment model that specifies the sort of content (model) it is associated with: create_table :comments do |t| t.column "subject", :string, :null => false t.column "body", :text, :null => false t.column "model_type_id", :integer, :null => false t.column "model_type", :varchar, :null => false end Then the data rows could look like these: # This item is associated with news_item ID = 1 some_comment: subject: "this is a comment" body: "and this is its content" mode...