为什么ResourceAllocation
中的验证没有被调用?
class Employee < ActiveRecord::Base
has_many :resource_allocations
accepts_nested_attributes_for :resource_allocations
validates_associated :resource_allocations
end
class ResourceAllocation < ActiveRecord::Base
belongs_to :employee
validate :location_id, :presence => true
validate :department_id, :presence => true
validate :period_from, :presence => true
validate :period_to, :presence => true
validate :allocation, :presence => true, :numericality => true
end