I have a error without explanation.
My error :
G::UndefinedColumn: ERROR: column "conjoncture_index_id" referenced in foreign key constraint does 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 do |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 do |t|
t.date "date"
t.float "value"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
I'm looking for "conjoncture_index" in my project but nothing... I think that a old version of the project uses "conjoncture_index" instead "conjoncture_indice" but all occurence are deleted.