Skip to content
Snippets Groups Projects
Commit 605b5ad1 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

Merge branch 'master' of github.com:noesya/osuny

parents 64383d10 66165208
No related branches found
No related tags found
No related merge requests found
......@@ -4,10 +4,12 @@ module Admin::Reorderable
included do
def reorder
ids = params[:ids] || []
first_object = model.find_by(id: ids.first)
ids.each.with_index do |id, index|
object = model.find_by(id: id)
object.update_column(:position, index + 1) unless object.nil?
end
first_object.sync_with_git if first_object&.respond_to?(:sync_with_git)
end
def model
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment