Sha256: 7a5e0bb45f6b2f7f911f8cda0d338edebc9b1e1ff6ef03f3d81d009796dd00c8
Contents?: true
Size: 906 Bytes
Versions: 1
Compression:
Stored size: 906 Bytes
Contents
require "addressable/uri" require "browser" require "geocoder" require "referer-parser" require "request_store" require "ahoy/version" require "ahoy/controller" require "ahoy/model" require "ahoy/engine" module Ahoy def self.visit_model ::Visit end # TODO private # performance hack for referer-parser def self.referrer_parser @referrer_parser ||= RefererParser::Referer.new("https://github.com/ankane/ahoy") end end ActionController::Base.send :include, Ahoy::Controller ActiveRecord::Base.send(:extend, Ahoy::Model) if defined?(ActiveRecord) if defined?(Warden) Warden::Manager.after_authentication do |user, auth, opts| request = Rack::Request.new(auth.env) if request.cookies["ahoy_visit"] visit = Ahoy.visit_model.where(visit_token: request.cookies["ahoy_visit"]).first if visit visit.user = user visit.save! end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ahoy_matey-0.1.1 | lib/ahoy_matey.rb |