This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Do not update search/router for this task

  • Loading branch information...
Mazz Mosley
Mazz Mosley committed Aug 9, 2012
1 parent dd30451 commit 6a1670717ee01e8761bff9b473b654dfb397accc
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/tasks/move_primary_section_into_taggable.rake
@@ -1,11 +1,13 @@
namespace :migrate do
desc "Copy data from attr primary_section to taggable primary_section"
task :move_primary_section_into_taggable => :environment do
- Artefact.all.each do |artefact|
- unless artefact.attributes['primary_section'].nil?
- puts "Updating #{artefact.slug} with #{artefact.attributes['primary_section']}"
- artefact.primary_section = artefact.attributes['primary_section']
- artefact.save!
+ Artefact.observers.disable :update_search_observer, :update_router_observer do
+ Artefact.all.each do |artefact|
+ unless artefact.attributes['primary_section'].nil?
+ puts "Updating #{artefact.slug} with #{artefact.attributes['primary_section']}"
+ artefact.primary_section = artefact.attributes['primary_section']
+ artefact.save!
+ end
end
end
end

0 comments on commit 6a16707

Please sign in to comment.