我在将数据输入表格时收到错误。
未定义的方法`价格'对于#
我能够将价格添加到我的订单表中,但是在添加新数据时。我在订单#new中收到了一个NoMethodError。我进入了我的文本编辑器并删除了突出显示的代码段,但输入价格的字段消失了所有剩下的是标题,Price。
显示/Users/nncyvallejo90/Documents/springproject/app/views/orders/_form.html.erb第20行:
未定义的方法`价格'对于#
Extracted source (around line #20):
<div class="field">
<%= f.label :price %><br>
**<%= f.text_field :price %>**
</div>
<div class="field">
<%= f.label :comics_name %><br>
模板包含跟踪:app / views / orders / new.html.erb
架构文件,似乎我没有为最后一个表进行迁移。我确实为客户和漫画书进行了迁移。
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150519022610) do
create_table "comic_books", force: :cascade do |t|
t.string "name"
t.decimal "price"
t.string "supplier"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "customers", force: :cascade do |t|
t.string "lastname"
t.string "firstname"
t.string "address"
t.string "city"
t.string "state"
t.string "zip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "orders", force: :cascade do |t|
t.integer "customer_id"
t.string "comics_name"
t.decimal "price"
t.integer "quanity"
t.decimal "total"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end