ruby on rails - Activerecord migration error on postgresql -


i have error without explanation.

my error :

g::undefinedcolumn: error:  column "conjoncture_index_id" referenced in foreign key constraint not exist : alter table "reports" add constraint "fk_rails_c25ad9a112" foreign key ("conjoncture_index_id")   references "conjoncture_indices" ("id") 

my migration :

class addcolumntoreports < activerecord::migration   def change     add_reference :reports, :conjoncture_indice, index: true     add_foreign_key :reports, :conjoncture_indices   end end 

my create table migration :

class createconjonctureindices < activerecord::migration   def change     create_table :conjoncture_indices |t|       t.date :date       t.float :value        t.timestamps null: false     end   end end 

my model :

class conjonctureindice < activerecord::base     has_many :reports     by_star_field :date end 

my conjonctureindice shema.rb part :

  create_table "conjoncture_indices", force: :cascade |t|     t.date     "date"     t.float    "value"     t.datetime "created_at",                 null: false     t.datetime "updated_at",                 null: false   end 

i'm looking "conjoncture_index" in project nothing... think old version of project uses "conjoncture_index" instead "conjoncture_indice" occurence deleted.

in rails , migration names plural whereas model names singular . model name should had been index cannot it's reserved keyword , plural of transforms conjunctureindices .

note - if still in doubt , can drop , re-create database suspect naming convention issue in case .


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -