Skip to content

Instantly share code, notes, and snippets.

@kineticac
Created June 5, 2013 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kineticac/5717936 to your computer and use it in GitHub Desktop.
Save kineticac/5717936 to your computer and use it in GitHub Desktop.
belongs_to :athlete
# before we create this new bookmark, we did not need to query SQL for athlete, now we do because of this new mixpanel.
# Let's assume a query lookup on athlete is 100ms. So now we have 110ms, which is more than 10x the response time.
def before_create
Mixpanel.track('some_event', {distinct_id: athlete.r_email})
end
# we didn't have to do any queries. Let's say this finishes in 10ms
def bookmark
AthleteCollegeBookmark.create({
athlete_id: params[:athlete_id],
college_id: params[:college_id]
})
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment