Last active
December 23, 2017 21:02
-
-
Save bernardobarreto/e2f374d2dc36955d7c82be0c70925b26 to your computer and use it in GitHub Desktop.
incrementable visits (wrong 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.counter += 1 | |
self.save! | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment