Class: Cats::Core::HubAuthorization
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Cats::Core::HubAuthorization
- Defined in:
- app/models/cats/core/hub_authorization.rb
Constant Summary collapse
- SOURCE =
"Source".freeze
- DESTINATION =
"Destination".freeze
- AUTHORIZATION_TYPES =
[SOURCE, DESTINATION].freeze
Instance Method Summary collapse
Instance Method Details
#set_unit ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/models/cats/core/hub_authorization.rb', line 25 def set_unit return if unit return unless dispatch_plan_item self.unit = dispatch_plan_item.unit end |
#validate_quantity ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'app/models/cats/core/hub_authorization.rb', line 33 def validate_quantity return unless quantity && unit && dispatch_plan_item = HubAuthorization.where( dispatch_plan_item: dispatch_plan_item, authorization_type: ) ValidationUtil.validate_quantity(self, "dispatch_plan_item", , "allocated") end |