Displaying 1 result from an estimated 1 matches for "related_user_id".
2011 Jan 15
3
has_many :through with Single Table inheritance
...d::Base
belongs_to :parent, :foreign_key => :user_id
belongs_to :student, :foreign_key => :user_id
end
class CreateRelationships < ActiveRecord::Migration
def self.up
create_table :relationships do |t|
t.integer :user_id, :null => false
t.integer :related_user_id, :null => false
t.string :status, :null => false
t.string :related_as, :limit => 100, :null => false #
e.g. ''parent'' or ''child'' or ''friend''
t.timestamps
end
end
def self.down
drop_tab...