Module: IWonder::Logging::ActionControllerMixins

Defined in:
lib/i_wonder/logging/action_controller_mixins.rb

Instance Method Summary collapse

Instance Method Details

#i_wonder_for_account_id(account_id) ⇒ Object



19
20
21
22
# File 'lib/i_wonder/logging/action_controller_mixins.rb', line 19

def ()
  self.request.env[ENV_KEY] ||= {} # this is for when the middleware doesn't get run first
  self.request.env[ENV_KEY]["account_id"] = .to_s
end

#i_wonder_for_session_id(session_id) ⇒ Object



24
25
26
27
# File 'lib/i_wonder/logging/action_controller_mixins.rb', line 24

def i_wonder_for_session_id(session_id)
  self.request.env[ENV_KEY] ||= {} # this is for when the middleware doesn't get run first
  self.request.env[ENV_KEY]["session_id"] = session_id.to_s
end

#i_wonder_for_user_id(user_id) ⇒ Object



14
15
16
17
# File 'lib/i_wonder/logging/action_controller_mixins.rb', line 14

def i_wonder_for_user_id(user_id)
  self.request.env[ENV_KEY] ||= {} # this is for when the middleware doesn't get run first
  self.request.env[ENV_KEY]["user_id"] = user_id.to_s
end

#report!(event_sym, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/i_wonder/logging/action_controller_mixins.rb', line 5

def report!(event_sym, options = {})
  options ||= {}
  options[:event_type] = event_sym.to_s # it will get converted when stored anyways.
  
  self.request.env[ENV_KEY] ||= {} # this is for when the middleware doesn't get run first
  self.request.env[ENV_KEY]["new_events"] ||= []
  self.request.env[ENV_KEY]["new_events"] << options
end