Sha256: c76c4034d46aad599a6c5e623edd985d89de51019f5c93a70cd8178efccf6202
Contents?: true
Size: 491 Bytes
Versions: 33
Compression:
Stored size: 491 Bytes
Contents
module Spree module Classifications class Reposition prepend Spree::ServiceModule::Base def call(classification:, position:) 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 end end end
Version data entries
33 entries across 33 versions & 1 rubygems