Sha256: 02a9fadc29a87fcd1677092824dc96e04ba2707aed896425b7f56c232cb63dd0

Contents?: true

Size: 346 Bytes

Versions: 139

Compression:

Stored size: 346 Bytes

Contents

module SortableActions
  extend ActiveSupport::Concern

  def reorder
    params[:ids_in_order].each_with_index do |id, sort_order|
      if (child_object = @parent_object.send(@child_collection).find_by_id(id))
        child_object.sort_order = sort_order
        child_object.save
      end
    end
    render json: true, status: :ok
  end
end

Version data entries

139 entries across 139 versions & 1 rubygems

Version Path
bullet_train-sortable-1.10.0 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.9.0 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.8.5 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.8.4 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.8.3 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.8.2 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.8.1 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.8.0 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.23 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.22 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.21 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.20 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.19 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.18 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.17 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.16 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.15 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.14 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.13 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.7.12 app/controllers/concerns/sortable_actions.rb