Module: SortableActions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/sortable_actions.rb
Instance Method Summary collapse
Instance Method Details
#reorder ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/controllers/concerns/sortable_actions.rb', line 4 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 |