Skip to content

Commit

Permalink
Validación entidad-reserva en deposito, #17
Browse files Browse the repository at this point in the history
  • Loading branch information
eloyesp committed Jan 18, 2012
1 parent c5993ad commit d370fa7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/models/deposito.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Deposito < Movimiento
validates :monto_final_currency, :presence => true
validate :monto_final_positivo

validate :concordancia_entidad_reserva

#
# Asociaciones
#
Expand Down Expand Up @@ -50,5 +52,11 @@ def monto_final_en_moneda_de_la_reserva
end
end

def concordancia_entidad_reserva
if reserva and entidad
errors.add(:base, "La entidad y la reserva no coinciden, vuelva a seleccionar la reserva") unless entidad == reserva.agency or entidad == reserva.operadora
end
end

end

0 comments on commit d370fa7

Please sign in to comment.