-1
對我的表單字段驗證有些麻煩。我有兩個文本字段需要驗證才能保留到下一頁。驗證運行正確,但驗證消息顯示類似導軌錯誤。字段驗證Ruby on Rails
任何人知道爲什麼它顯示像軌誤差。
型號:
class Assignment < ActiveRecord::Base
include Workflow
belongs_to :folder
belongs_to :employee
after_initialize :init_start_dateenter code here
validates_presence_of :folder_id, :employee_id
end
控制器:
class AssignmentsController < ApplicationController
def create
@assignment = Assignment.new(assignment_params)
respond_to do |format|
if @assignment.save!
format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }
format.json { render :show, status: :created, location: @assignment }
@assignment.folder.update({status: 'assigned'})
else
format.html { render :new }
format.json { render json: @assignment.errors, status: :unprocessable_entity }
end
end
end
end
我有兩個形式驗證領域。在這種形式中,驗證錯誤顯示正確。
謝謝JamesWatling :)這是我的錯誤 – ArpithaGeorge