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

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

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -