class CashOut < ActiveRecord::Base belongs_to :user, :class_name => 'User' belongs_to :received_by, :class_name => 'User' belongs_to :open_cash_register has_many :cash_out_details has_one :cash_register, :through => :open_cash_register has_one :pointsale, :through => :cash_register ##--- Llevar registro de Actividad del usuario audited accepts_nested_attributes_for :cash_out_details # accepts_nested_attributes_for :cash_out_details, # :reject_if => proc { |att| att['received_by_id'].blank? } validates :received_cash, presence: { message: "Debe indicar el efectivo a retirar." }, :on => [:create] validates :cash_fund, presence: { message: "Debe indicar el fondo de caja." }, :on => [:create] validates :received_by_id, presence: { message: "Debe seleccionar quien recibe el dinero del corte." }, :on => [:create] validates_associated :cash_out_details end