Class: Spree::Classifications::Reposition Deprecated
- Inherits:
-
Object
- Object
- Spree::Classifications::Reposition
- Includes:
- ServiceModule::Base
- Defined in:
- app/services/spree/classifications/reposition.rb
Overview
Deprecated.
This service is deprecated and will be removed in Spree 5.5.
Instance Method Summary collapse
Methods included from ServiceModule::Base
Instance Method Details
#call(classification:, position:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/spree/classifications/reposition.rb', line 7 def call(classification:, position:) Spree::Deprecation.warn( "#{self.class.name} is deprecated and will be removed in Spree 5.5.", caller_locations(2) ) if position.is_a?(String) && !position.match(/^\d+$/) return failure(nil, I18n.t('errors.messages.not_a_number')) end # Because position we get back is 0-indexed. # acts_as_list is 1-indexed. classification.insert_at(position.to_i + 1) success(classification) end |