-1
フォームフィールドの検証に問題があります。次のページに進む前に検証が必要な2つのテキストフィールドがあります。検証は正しく実行されますが、検証メッセージはrailsエラーのように表示されます。フィールド検証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
私はフィールドを検証するために2つの以上のフォームを持っています。そのフォームでは、検証エラーが正しく表示されます。
ありがとうJames Watling :)それは私のミスです – ArpithaGeorge