Rails ActiveRecord How to make foreign key in second table? -


simple question: how can make 'rateable_id' foreign key bboys table?

db schema:

activerecord::schema.define(version: 20140331112614)    create_table "bboys", force: true |t|     t.string   "name"     t.string   "crew"     t.string   "country"     t.datetime "created_at"     t.datetime "updated_at"     t.string   "avatar_file_name"     t.string   "avatar_content_type"     t.integer  "avatar_file_size"     t.datetime "avatar_updated_at"   end    create_table "rates", force: true |t|     t.integer  "rater_id"     t.integer  "rateable_id"     t.string   "rateable_type"     t.float    "stars",         null: false     t.string   "dimension"     t.datetime "created_at"     t.datetime "updated_at"   end 

thank you!

check gem foreigner, can you. don't know want. try write more description question.


Comments

Popular posts from this blog

What can cause "Required Package 'IndyCore' not found" when compiling a Delphi 2010 project? -

Change the color of an oval at click in Java AWT -