Skip to content

Instantly share code, notes, and snippets.

@csaunders
Created October 1, 2013 15:43
Show Gist options
  • Save csaunders/6780502 to your computer and use it in GitHub Desktop.
Save csaunders/6780502 to your computer and use it in GitHub Desktop.
[11:28:41] <csaunders> maybe you can leverage increment/decrement?
[11:29:09] <csaunders> items = Item.where(query)
[11:29:31] <csaunders> value > 0 ? items.increment(value) : items.decrement(value)
[11:29:33] <csaunders> ¯\(°_o)/¯
[11:29:57] <csaunders> also I think my syntax is wrong :/
[11:30:09] <csaunders> but those might have an answer
[11:31:08] <csaunders> keep in mind, increment/decrement don't fire callbacks…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment