当我尝试在表单上运行以下代码时,我收到以下错误消息:
<%= simple_form_for(@store) do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <div class="form-inputs"> <%= f.input :location, required: true %> <%= f.input :branch_manager, required: true %> <%= f.input :store_ID, required: true %> </div> <div class="form-actions"> <%= f.button :submit %> </div> <% end %>
我检查了模型,控制器和模式,但store_ID与其他工作参数一致。我如何首先“定义”它?
schema.rb
以下是我的create_table "stores", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
t.string "location"
t.string "branch_manager"
t.integer "store_ID"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
import UIKit
class CustomDisclosureIndicator: UIView {
@IBInspectable
public var color: UIColor = UIColor.darkGray {
didSet {
setNeedsDisplay()
}
}
override func draw(_ rect: CGRect) {
let context = UIGraphicsGetCurrentContext()
let x = self.bounds.maxX - 3
let y = self.bounds.midY
let R = CGFloat(4.5)
context?.move(to: CGPoint(x: x-R, y: y-R))
context?.addLine(to: CGPoint(x: x, y: y))
context?.addLine(to: CGPoint(x: x-R, y: y+R))
context?.setLineCap(.square)
context?.setLineJoin(.miter)
context?.setLineWidth(2)
color.setStroke()
context?.strokePath()
}
}
答案 0 :(得分:0)
我认为你没有按照你说的那样进行迁移
&#34;我在生成所有内容后添加了ID字段,因此我不知道这是否会产生差异&#34;
有了这个,你应该解决:
rails db:migrate