Post and Event
create_table :posts do |t|
t.column :title, :string
t.column :body, :text
t.column :created_by, :int
t.column :updated_by, :int
end
create_table :events do |t|
t.column :title, :string
t.column :body, :text
t.column :location, :text
t.column :created_by, :int
t.column :updated_by, :int
end
create_table :post_comments do |t|
t.column :post_id, :int
end
create_table :event_comments do |t|
t.column :event_id, :int
end
create_table :attendees do |t|
t.column :event_id, :int
end
class Post < ActiveRecord::Base
acts_as_taggable
has_many :comments, :class_name => 'PostComment'
belongs_to :creator
belongs_to :updater
end
class Event < Content
acts_as_taggable
has_many :comments, :class_name => 'EventComment'
has_many :attendees
belongs_to :creator
belongs_to :updater
end
one table per concrete class - shared properties are duplicated in the tables

one table for each class - shared properties are stored in the parent class

single table that has columns for all the fields of the various classes

class Blood < ActiveRecord::Base
has_many :donors
def inheritance_column
'class_name'
end
end
Post and Event
create_table :contents do |t|
t.column :type, :string
t.column :title, :string
t.column :body, :text
t.column :location, :text
t.column :created_by, :int
t.column :updated_by, :int
end
create_table :comments do |t|
t.column :content_id, :int
end
create_table :attendees do |t|
t.column :content_id, :int
end
class Content < ActiveRecord::Base
acts_as_taggable
has_many :comments
belongs_to :creator
belongs_to :updater
end
class Post < Content
end
class Event < Content
has_many :attendees
end
Content.find returns Post and Event objectsEvent.find only returns Event objectsProjectStatus, UserStatus)Widget, SuperWidget, etc...):through, :include)?after_save