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.6.5 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.6.4 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.6.3 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.6.2 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.6.1 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.6.0 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.5.2 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.5.1 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.5.0 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.11 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.10 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.9 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.8 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.7 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.6 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.5 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.4 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.3 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.2 app/controllers/concerns/sortable_actions.rb
bullet_train-sortable-1.4.1 app/controllers/concerns/sortable_actions.rb