lib/ahoy/controller.rb in ahoy_matey-0.0.4 vs lib/ahoy/controller.rb in ahoy_matey-0.1.0
- old
+ new
@@ -1,16 +1,19 @@
module Ahoy
module Controller
def self.included(base)
base.helper_method :current_visit
+ base.before_filter do
+ RequestStore.store[:ahoy_controller] ||= self
+ end
end
protected
def current_visit
if cookies[:ahoy_visit]
- @current_visit ||= Ahoy::Visit.where(visit_token: cookies[:ahoy_visit]).first
+ @current_visit ||= Ahoy.visit_model.where(visit_token: cookies[:ahoy_visit]).first
end
end
end
end