Class: MoleLog
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- MoleLog
- Defined in:
- lib/mole/models/mole_log.rb
Overview
Log Model - Tracks and record user interactions with various features This will make it easy to write an app on top on the MOle to track a particular application utilization.
Class Method Summary collapse
-
.log_details(context) ⇒ Object
extract orginating ip address and browser type.
-
.log_it(context, feature, user_id, args) ⇒ Object
mole the bastard - create db entry into mole logs.
Class Method Details
.log_details(context) ⇒ Object
extract orginating ip address and browser type
22 23 24 25 26 27 28 |
# File 'lib/mole/models/mole_log.rb', line 22 def log_details( context ) #:nodoc: ip_addr, browser_type = nil if context.respond_to? :request ip_addr, browser_type = context.request.env['REMOTE_ADDR'], context.request.env['HTTP_USER_AGENT'] end return ip_addr, browser_type end |
.log_it(context, feature, user_id, args) ⇒ Object
mole the bastard - create db entry into mole logs
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mole/models/mole_log.rb', line 9 def log_it( context, feature, user_id, args ) args ||= "no args" user_id ||= "N/A" ip_addr, browser_type = log_details( context ) MoleLog.create( :mole_feature => feature, :user_id => user_id, :host_name => `hostname`, :params => args.to_yaml, :ip_address => ip_addr, :browser_type => browser_type ) end |