Module: Comfy::ReorderAction
- Extended by:
- ActiveSupport::Concern
- Included in:
- Admin::Cms::FilesController, Admin::Cms::LayoutsController, Admin::Cms::PagesController, Admin::Cms::SnippetsController
- Defined in:
- app/controllers/concerns/comfy/reorder_action.rb
Instance Method Summary collapse
Instance Method Details
#reorder ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/controllers/concerns/comfy/reorder_action.rb', line 11 def reorder resource_class = self.class.reorder_action_resource (params.permit(order: [])[:order] || []).each_with_index do |id, index| resource_class.where(id: id).update_all(position: index) end head :ok end |