Sha256: 5fa7d44149bd673fc81c436d1198528197f2a11f2d071f1923428bbdc271dd9e
Contents?: true
Size: 398 Bytes
Versions: 12
Compression:
Stored size: 398 Bytes
Contents
# frozen_string_literal: true module Occams::ReorderAction extend ActiveSupport::Concern included do mattr_accessor :reorder_action_resource end def reorder resource_class = self.class.reorder_action_resource (params.permit(order: [])[:order] || []).each_with_index do |id, index| resource_class.where(id: id).update_all(position: index) end head :ok end end
Version data entries
12 entries across 12 versions & 1 rubygems