Sha256: e5f3d2153d60704726daf42bb1e2f7a62672e31fe3e999335a5926b528cb5d3d

Contents?: true

Size: 322 Bytes

Versions: 33

Compression:

Stored size: 322 Bytes

Contents

module Headmin
  module ActsAsList
    def handle_positions(model:)
      position_params[:ids].each_with_index do |id, index|
        model.where(id: id).update_all(position: index + 1)
      end
      head :no_content
    end

    private

    def position_params
      params.permit(:locale, ids: [])
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
headmin-0.6.3 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.2.9 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.6.2 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.6.1 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.6.0 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.9 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.8 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.7 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.6 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.5 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.4 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.3 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.2 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.1 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.5.0 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.4.2 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.4.1 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.4.0 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.3.4 app/controllers/concerns/headmin/acts_as_list.rb
headmin-0.3.3 app/controllers/concerns/headmin/acts_as_list.rb