Added Analytics function to track user hits by ip address, referrer and user agent
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class Analytics < ActiveRecord::Base
|
||||
attr_accessible :ip_address, :referrer, :user_agent
|
||||
|
||||
scope :hits_by_ip, ->(ip,col="*") { select("#{col}").where("ip_address = '#{ip}'")}
|
||||
|
||||
def self.count_by_col(col)
|
||||
calculate(:count, col)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user