Module: Ahoy::Controller
- Defined in:
- lib/ahoy/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/ahoy/controller.rb', line 6 def self.included(base) base.helper_method :current_visit base.helper_method :ahoy base.before_filter :set_ahoy_cookies base.before_filter :track_ahoy_visit base.before_filter do RequestStore.store[:ahoy] ||= ahoy end end |
Instance Method Details
#ahoy ⇒ Object
16 17 18 |
# File 'lib/ahoy/controller.rb', line 16 def ahoy @ahoy ||= Ahoy::Tracker.new(controller: self) end |
#current_visit ⇒ Object
20 21 22 |
# File 'lib/ahoy/controller.rb', line 20 def current_visit ahoy.visit end |
#set_ahoy_cookies ⇒ Object
24 25 26 27 |
# File 'lib/ahoy/controller.rb', line 24 def ahoy. ahoy. end |
#track_ahoy_visit ⇒ Object
29 30 31 32 33 |
# File 'lib/ahoy/controller.rb', line 29 def track_ahoy_visit if ahoy.new_visit? ahoy.track_visit(defer: !Ahoy.track_visits_immediately) end end |