Do the update in JS
This commit is contained in:
parent
bc35388d1f
commit
94fe0b4049
1 changed files with 3 additions and 3 deletions
|
|
@ -30,9 +30,9 @@ namespace :migrations do
|
||||||
task :contacts_as_requests do
|
task :contacts_as_requests do
|
||||||
require File.join(Rails.root,"config/environment")
|
require File.join(Rails.root,"config/environment")
|
||||||
puts "Migrating contacts..."
|
puts "Migrating contacts..."
|
||||||
Contact.find_each(:pending => nil){|contact|
|
MongoMapper.database.eval('
|
||||||
contact.pending = false; contact.save
|
db.contacts.find({pending : null}).forEach(function(contact){
|
||||||
}
|
db.contacts.update({"_id" : contact["_id"]}, {"$set" : {"pending" : false}}); });')
|
||||||
puts "Deleting stale requests..."
|
puts "Deleting stale requests..."
|
||||||
Request.find_each(:sent => true){|request|
|
Request.find_each(:sent => true){|request|
|
||||||
request.delete
|
request.delete
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue