lib/ahoy/controller.rb in ahoy_matey-0.1.8 vs lib/ahoy/controller.rb in ahoy_matey-0.2.0
- old
+ new
@@ -1,19 +1,24 @@
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