cash_out.rb 760 B

123456789101112131415161718
  1. class CashOut < ActiveRecord::Base
  2. belongs_to :user, class_name: 'User'
  3. belongs_to :received_by, class_name: 'User'
  4. belongs_to :open_cash_register
  5. has_many :cash_out_details
  6. has_one :cash_register, through: :open_cash_register
  7. has_one :pointsale, through: :cash_register
  8. ##--- Llevar registro de Actividad del usuario
  9. audited
  10. accepts_nested_attributes_for :cash_out_details
  11. validates :received_cash, presence: { message: "Debe indicar el efectivo a retirar." }, on: [:create]
  12. validates :cash_fund, presence: { message: "Debe indicar el fondo de caja." }, on: [:create]
  13. validates :received_by_id, presence: { message: "Debe seleccionar quién recibe el dinero del corte." }, on: [:create]
  14. validates_associated :cash_out_details
  15. end