Class: Ecom::Core::CrewContract
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Ecom::Core::CrewContract
- Includes:
- AASM
- Defined in:
- app/models/ecom/core/crew_contract.rb
Instance Method Summary collapse
Instance Method Details
#contract_in_effect_exists? ⇒ Boolean
23 24 25 26 27 28 29 |
# File 'app/models/ecom/core/crew_contract.rb', line 23 def contract_in_effect_exists? contracts_in_effect = Ecom::Core::CrewContract.where(crew_id: crew_id, status: 'in_effect') return true unless contracts_in_effect.empty? false end |
#validate_date_range ⇒ Object
31 32 33 34 35 |
# File 'app/models/ecom/core/crew_contract.rb', line 31 def validate_date_range return unless from && to errors.add(:to, 'cannot be before from date.') if from >= to end |