jam-cloud/web/app/controllers/application_controller.rb

37 lines
905 B
Ruby
Raw Normal View History

require 'bugsnag'
2012-08-31 02:09:02 +00:00
class ApplicationController < ActionController::Base
protect_from_forgery
include ApplicationHelper
include SessionsHelper
2013-09-22 01:25:20 +00:00
# inject username/email into bugsnag data
before_bugsnag_notify :add_user_info_to_bugsnag
before_filter do
if current_user.nil?
if (code = params[AffiliatePartner::PARAM_REFERRAL]).present? &&
cookies[AffiliatePartner::PARAM_COOKIE].blank?
cookies[AffiliatePartner::PARAM_COOKIE] = code
end
end
2014-04-20 22:54:49 +00:00
end
def affiliate_code
cookies[AffiliatePartner::PARAM_COOKIE]
2014-04-20 22:54:49 +00:00
end
2013-09-22 01:25:20 +00:00
private
def add_user_info_to_bugsnag(notif)
# Add some app-specific data which will be displayed on a custom
# "User Info" tab on each error page on bugsnag.com
unless current_user.nil?
notif.add_tab(:user_info, {
name: current_user.name,
email: current_user.email
})
end
end
2012-08-31 02:09:02 +00:00
end