I have an error message - "ActiveModel::UnknownAttributeError: unknown attribute 'price' for Product." I've also run rails generate migration add_Price_to_Product
but still threw me this error while seeding. I've also run this rails g model Product name 'price:decimal{12,3}' active:boolean
and threw back a migration conflict from the previous migration! I am trying to create a rails shopping cart; any help would be very much appreciated.
Thank you!
this is the schema.rb
create_table "products", force: :cascade do |t|
t.string "product_name"
t.string "description"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "condition"
t.string "name"
t.integer "user_id"
end
this is product.rb
class Product < ActiveRecord::Base
has_many :order_items
default_scope { where(active: true) }
end
Aucun commentaire:
Enregistrer un commentaire