Skip to content

Instantly share code, notes, and snippets.

@starrhorne
Created January 19, 2012 02:38
Show Gist options
  • Save starrhorne/1637337 to your computer and use it in GitHub Desktop.
Save starrhorne/1637337 to your computer and use it in GitHub Desktop.
class Metric
include MongoMapper::Document
key :timestamps, Array
key :action, String
def self.track(action)
collection.update(
{ :action => action },
{ "$push" => { :timestamps => Time.now }},
:upsert => true)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment