Class: Cats::Core::TransportPlan
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Cats::Core::TransportPlan
- Defined in:
- app/models/cats/core/transport_plan.rb
Constant Summary collapse
- REGIONAL =
Plan types
"Regional".freeze
- NON_REGIONAL =
"Non Regional".freeze
- PLAN_TYPES =
[REGIONAL, NON_REGIONAL].freeze
Instance Method Summary collapse
Instance Method Details
#validate_region ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/models/cats/core/transport_plan.rb', line 18 def validate_region return unless plan_type errors.add(:region, "should be null.") if plan_type == NON_REGIONAL && region errors.add(:region, "should not be null.") if plan_type == REGIONAL && !region errors.add(:region, "is not valid.") if region && region.location_type != Location::REGION end |