Mysql2::错误:where子句中的列未知
我是rails 4的新手,我想在我的应用程序中添加多个图像。我尝试了本文中给出的修复。结果出现了新的错误Mysql2::错误:where子句中的列未知,mysql,ruby-on-rails-4,paperclip,Mysql,Ruby On Rails 4,Paperclip,我是rails 4的新手,我想在我的应用程序中添加多个图像。我尝试了本文中给出的修复。结果出现了新的错误 Mysql2::Error: Unknown column 'pictures.product_id' in 'where clause': SELECT pictures.* FROM pictures WHERE pictures.product_id = 9 schema.rb create_table "products", force: :cascade do |t| t.d
Mysql2::Error: Unknown column 'pictures.product_id' in 'where clause': SELECT pictures.* FROM pictures WHERE pictures.product_id = 9
schema.rb
create_table "products", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name", limit: 255
t.integer "price", limit: 4
t.text "description", limit: 65535
t.text "reason", limit: 65535
t.integer "user_id", limit: 4
t.string "image_file_name", limit: 255
t.string "image_content_type", limit: 255
t.integer "image_file_size", limit: 4
t.datetime "image_updated_at"
t.string "status", limit: 255
t.integer "category_id", limit: 4
end
有人能帮我解决这个问题吗?根据您的模式,产品表中没有产品id列 若您想要product_id列,则必须使用ALTER TABLE查询并在products中添加product_id 桌状
ALTER TABLE products
ADD COLUMN product_id INT NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (product_id);
在
图片表格中是否有产品id
?是否可以粘贴表格定义?