このコードは正しいと思いますが、何が起こるかわかりませんか? これが私のコードです:
registration.rb :
class Registration < ActiveRecord::Base
attr_accessor :create_registration, :is_contact_registration, :is_appointment_registration
validates :client_id, presence: true
validates :type, presence: true
validates :contact_thru, presence: true
validates :purpose_message, presence: true, :unless => :is_appointment_registration
validates :action_needed, presence: true, :unless => :is_appointment_registration
validates :date_created, presence: true
validates :owner_id, presence: true
validates :status, presence: true
validates :notes, presence: true
end
私のコントローラー、
def create
binding.pry
@registration = Registration.new(record_params)
@registration.owner_id = current_user.id
@registration.is_appointment_registration = true
if @registration.save
render json: @registration, status: :created, location: @registration
else
render json: @registration.errors, status: :unprocessable_entity
end
end
問題は、データを と に配置する:notes
と:place
、検証がまだ失敗することです。