Skip to content

Instantly share code, notes, and snippets.

@raws
Forked from prokop75/gist:a1e141c10b828d03ae74aca3f06e06e4
Last active November 12, 2016 22:52
Show Gist options
  • Save raws/6e51e293df0a81d20e25bf27ec3cb724 to your computer and use it in GitHub Desktop.
Save raws/6e51e293df0a81d20e25bf27ec3cb724 to your computer and use it in GitHub Desktop.
Chopt make order ahead orders not reorderable
chopt_location_ids = [5652, 6397, 6646, 6647, 6648, 6650, 6651, 6652, 6653,
6654, 7169, 7170, 7453, 7454, 7624, 7625, 7626, 7627, 7628, 7629, 7630,
7631, 7632, 7633, 8015, 8482, 10153, 10619, 10620, 10823, 10824, 11457,
11560, 14504, 14505, 14820, 15323, 17342, 22070, 22074, 22100, 22101]
orders = Order.completed.where(location_id: chopt_location_ids,
reorderable: true)
# Iterate through all orders, mark as reorderable = false, print IDs
orders.find_each do |order|
order.update_column :reorderable, false
puts order.id
end
# Or: update all in one go, returns number of rows updated
orders.update_all reorderable: false #=> 181405
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment