我从'餐馆'表中删除了'烹饪'栏目,现在我创建或编辑餐馆的表格给我一个未定义的烹饪错误方法。以下是rails控制台的示例。
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
谢谢,
答案 0 :(得分:0)
问题在于餐馆模型仍在尝试验证烹饪的存在。