Module: Ahoy::Controller
- Defined in:
- lib/ahoy/controller.rb
Class Method Summary collapse
Instance Method Summary collapse
- #ahoy ⇒ Object
- #current_visit ⇒ Object
- #set_ahoy_cookies ⇒ Object
- #set_ahoy_request_store ⇒ Object
- #track_ahoy_visit ⇒ Object
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/ahoy/controller.rb', line 3 def self.included(base) if base.respond_to?(:helper_method) base.helper_method :current_visit base.helper_method :ahoy end base.before_action :set_ahoy_cookies, unless: -> { Ahoy.api_only } base.before_action :track_ahoy_visit, unless: -> { Ahoy.api_only } base.around_action :set_ahoy_request_store end |
Instance Method Details
#ahoy ⇒ Object
13 14 15 |
# File 'lib/ahoy/controller.rb', line 13 def ahoy @ahoy ||= Ahoy::Tracker.new(controller: self) end |
#current_visit ⇒ Object
17 18 19 |
# File 'lib/ahoy/controller.rb', line 17 def current_visit ahoy.visit end |
#set_ahoy_cookies ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/ahoy/controller.rb', line 21 def if Ahoy. ahoy. ahoy. else # delete cookies if exist ahoy.reset end end |