Module: Headmin::ActsAsList

Defined in:
app/controllers/concerns/headmin/acts_as_list.rb

Instance Method Summary collapse

Instance Method Details

#handle_positions(model:) ⇒ Object



3
4
5
6
7
8
# File 'app/controllers/concerns/headmin/acts_as_list.rb', line 3

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