Skip to content

Instantly share code, notes, and snippets.

@speedmax
Created November 12, 2008 09:40
Show Gist options
  • Save speedmax/24121 to your computer and use it in GitHub Desktop.
Save speedmax/24121 to your computer and use it in GitHub Desktop.
class Profile < ActiveRecord:Base
# Controller pass request object as param
# Stat wrapper sends out async request to web services
def register_pageview(request)
api = "asdf2134asfd2134"
@stat = SimpleStat.new(api, request)
end
# pageviews most likely to be cached
def monthly_pageviews
@stat.pageviews(1.month.from.now)
end
def daily_pageviews
@stat.pageviews(1.day.from.now)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment