Last active
December 23, 2017 21:02
-
-
Save bernardobarreto/476791876b523afea8653f3c4401f4cf to your computer and use it in GitHub Desktop.
incrementable visits (right way)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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