Skip to content

Instantly share code, notes, and snippets.

@StevenJL
Created September 18, 2018 19:28
Show Gist options
  • Select an option

  • Save StevenJL/cf6b7295e7f5314ca0555af81d80c107 to your computer and use it in GitHub Desktop.

Select an option

Save StevenJL/cf6b7295e7f5314ca0555af81d80c107 to your computer and use it in GitHub Desktop.
awesome_users = User.where(payment_status: "on_time")
# Instead of updating each individual record
deadbeat_users.each do |user|
user.update(awesome: true)
end
# Just do one bulk update
User.where(payment_status: "on_time").update_all(awesome: true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment