Skip to content

Instantly share code, notes, and snippets.

@bernardobarreto
Last active December 23, 2017 21:02
Show Gist options
  • Save bernardobarreto/476791876b523afea8653f3c4401f4cf to your computer and use it in GitHub Desktop.
Save bernardobarreto/476791876b523afea8653f3c4401f4cf to your computer and use it in GitHub Desktop.
incrementable visits (right way)
class Visit
include Mongoid::Document
field :counter, type: Integer
def increment!
self.inc(counter: 1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment