Sha256: 9e2c6de3d078e134e88d0db44640f7d4ccffdbaf8d1ef70128553c13426506e6
Contents?: true
Size: 1.41 KB
Versions: 11
Compression:
Stored size: 1.41 KB
Contents
# 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 MoleLog < ActiveRecord::Base belongs_to :mole_feature class << self # mole the bastard - create db entry into mole logs 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 # extract orginating ip address and browser type 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 end end
Version data entries
11 entries across 11 versions & 2 rubygems