I am currently using mixpanel with the default ‘mixpanel’ gem for analytics and have some calls set up in my controllers. I would like those calls to only run in the production environment. Is the best way to do this something like this for every call:
@mixpanel.track_event("Job Accepted", {:user=> current_user.id}) if RAILS_ENV == 'production'
Seems like overkill, but I’m struggling to think of a better solution. Any help would be great!
You’ve got the right idea. Though you might want to use:
instead. ( See Rails.env vs RAILS_ENV )