Sha256: 9805d97986c331eb8a7e7ab345906d6524284e4cfdedb71b77452590318e1be2
Contents?: true
Size: 1.37 KB
Versions: 29
Compression:
Stored size: 1.37 KB
Contents
module Spree module Api module V2 module Platform class TaxonsController < ResourceController include ::Spree::Api::V2::Platform::NestedSetRepositionConcern private def successful_reposition_actions reload_taxon_and_set_new_permalink(resource) update_permalinks_on_child_taxons render_serialized_payload { serialize_resource(resource) } end def reload_taxon_and_set_new_permalink(taxon) taxon.reload taxon.set_permalink taxon.save! end def update_permalinks_on_child_taxons resource.descendants.each do |taxon| reload_taxon_and_set_new_permalink(taxon) end end def model_class Spree::Taxon end def scope_includes node_includes = %i[icon parent taxonomy] { parent: node_includes, children: node_includes, taxonomy: [root: node_includes], icon: [attachment_attachment: :blob] } end def serializer_params super.merge(include_products: action_name == 'show') end def spree_permitted_attributes super + [:new_parent_id, :new_position_idx] end end end end end end
Version data entries
29 entries across 29 versions & 3 rubygems