don't run callbacks or validations for reorder
John Hawthorn
committed Jan 06, 2012
commit 0adfcc4b269e4fa45571058752b4e81b90bb13ca
Showing 3
changed files with
3 additions
and 9 deletions
app/controllers/cms_admin/layouts_controller.rb
+1
-3
| @@ | @@ -44,9 +44,7 @@ class CmsAdmin::LayoutsController < CmsAdmin::BaseController |
| def reorder | |
| (params[:cms_layout] || []).each_with_index do |id, index| | |
| - | if (cms_layout = Cms::Layout.find_by_id(id)) |
| - | cms_layout.update_attribute(:position, index) |
| - | end |
| + | Cms::Layout.where(:id => id).update_all(:position => index) |
| end | |
| render :nothing => true | |
| end | |
app/controllers/cms_admin/pages_controller.rb
+1
-3
| @@ | @@ -65,9 +65,7 @@ class CmsAdmin::PagesController < CmsAdmin::BaseController |
| def reorder | |
| (params[:cms_page] || []).each_with_index do |id, index| | |
| - | if (cms_page = Cms::Page.find_by_id(id)) |
| - | cms_page.update_attribute(:position, index) |
| - | end |
| + | Cms::Page.where(:id => id).update_all(:position => index) |
| end | |
| render :nothing => true | |
| end | |
app/controllers/cms_admin/snippets_controller.rb
+1
-3
| @@ | @@ -44,9 +44,7 @@ class CmsAdmin::SnippetsController < CmsAdmin::BaseController |
| def reorder | |
| (params[:cms_snippet] || []).each_with_index do |id, index| | |
| - | if (cms_snippet = Cms::Snippet.find_by_id(id)) |
| - | cms_snippet.update_attribute(:position, index) |
| - | end |
| + | Cms::Snippet.where(:id => id).update_all(:position => index) |
| end | |
| render :nothing => true | |
| end | |