lib/ahoy.rb in ahoy_matey-1.5.1 vs lib/ahoy.rb in ahoy_matey-1.5.2
- old
+ new
@@ -82,10 +82,16 @@
self.throttle_period = 1.minute
mattr_accessor :job_queue
self.job_queue = :ahoy
+ mattr_accessor :api_only
+ self.api_only = false
+
+ mattr_accessor :protect_from_forgery
+ self.protect_from_forgery = false
+
def self.ensure_uuid(id)
valid = UUIDTools::UUID.parse(id) rescue nil
if valid
id
else
@@ -106,11 +112,16 @@
mattr_accessor :track_bots
self.track_bots = false
end
if defined?(Rails)
- ActionController::Base.send :include, Ahoy::Controller
- ActiveRecord::Base.send(:extend, Ahoy::Model) if defined?(ActiveRecord)
+ ActiveSupport.on_load(:action_controller) do
+ ActionController::Base.send :include, Ahoy::Controller
+ end
+
+ ActiveSupport.on_load(:active_record) do
+ ActiveRecord::Base.send(:extend, Ahoy::Model)
+ end
# ensure logger silence will not be added by activerecord-session_store
# otherwise, we get SystemStackError: stack level too deep
begin
require "active_record/session_store/extension/logger_silencer"