Sha256: 2832179bccab2c281f556d6b2def585fa46ddaaa119e1a45ebc5470e4bb727fb
Contents?: true
Size: 535 Bytes
Versions: 3
Compression:
Stored size: 535 Bytes
Contents
module Ahoy module Controller def self.included(base) base.helper_method :current_visit base.helper_method :ahoy base.before_filter do RequestStore.store[:ahoy_controller] ||= self end end def current_visit visit_token = cookies[:ahoy_visit] || request.headers["Ahoy-Visit"] if visit_token @current_visit ||= Ahoy.visit_model.where(visit_token: visit_token).first end end def ahoy @ahoy ||= Ahoy::Tracker.new(controller: self) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ahoy_matey-0.2.2 | lib/ahoy/controller.rb |
ahoy_matey-0.2.1 | lib/ahoy/controller.rb |
ahoy_matey-0.2.0 | lib/ahoy/controller.rb |