Class: Comable::Shipment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Comable::Shipment
- Includes:
- Ransackable
- Defined in:
- app/models/comable/shipment.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.state_names ⇒ Object
54 55 56 |
# File 'app/models/comable/shipment.rb', line 54 def state_names state_machine.states.keys end |
Instance Method Details
#complete! ⇒ Object
69 70 71 |
# File 'app/models/comable/shipment.rb', line 69 def complete! touch :completed_at end |
#completed? ⇒ Boolean
65 66 67 |
# File 'app/models/comable/shipment.rb', line 65 def completed? completed_at? end |
#stated?(target_state) ⇒ Boolean
59 60 61 62 63 |
# File 'app/models/comable/shipment.rb', line 59 def stated?(target_state) target_state_index = self.class.state_names.index(target_state.to_sym) current_state_index = self.class.state_names.index(state_name) target_state_index < current_state_index end |