User.find_each |user|
user.update_attributes(status: 'active')
end
But that takes a long to complete. Executing raw sql over ActiveRecord speeds things up tremendously.
User.connection.execute("update users set status = 'active'")
User.find_each |user|
user.update_attributes(status: 'active')
end
But that takes a long to complete. Executing raw sql over ActiveRecord speeds things up tremendously.
User.connection.execute("update users set status = 'active'")
No comments:
Post a Comment