0
私の 'restaurants'テーブルから 'cuisine'カラムを削除したところ、レストランを作成または編集するためのフォームが私に料理のエラーのための未定義のメソッドを与えます。次に、レールコンソールの例を示します。ここでテーブルから削除された列の定義されていないメソッドエラー
irb(main):002:0> restaurant = Restaurant.new
irb(main)<Restaurant id: nil, name: nil, rating: nil, created_at: nil, updated_at: nil, latitude: nil, longitude: nil, address: nil, owner_id: nil>
irb(main):003:0> restaurant.save
(0.2ms) BEGIN
(0.2ms) ROLLBACK
NoMethodError: undefined method `cuisine' for #<Restaurant:0x007f9b0c258e20>
from (irb):3
irb(main):004:0>
は、レストランのための私のスキーマです:
create_table "restaurants", force: :cascade do |t|
t.string "name"
t.integer "rating"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.float "latitude"
t.float "longitude"
t.string "address"
t.bigint "owner_id"
t.index ["owner_id"], name: "index_restaurants_on_owner_id"
end
おかげで、