Class: Ecom::Core::CrewIdCard
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ecom::Core::CrewIdCard
- Defined in:
- app/models/ecom/core/crew_id_card.rb
Constant Summary collapse
Instance Method Summary collapse
Instance Method Details
#invalidate_other_ids ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'app/models/ecom/core/crew_id_card.rb', line 25 def invalidate_other_ids return if crew_id.nil? return if status_changed?(from: 'Valid', to: 'Invalid') Ecom::Core::CrewIdCard .where(crew_id: crew_id, status: 'Valid') .update(status: 'Invalid') end |
#valid_until_validator ⇒ Object
19 20 21 22 23 |
# File 'app/models/ecom/core/crew_id_card.rb', line 19 def valid_until_validator return unless valid_until && issued_on errors.add(:valid_until, 'cannot be before issue date.') if issued_on >= valid_until end |