Sha256: ad07b4ca836520f2aa4c2ed38a1774d80a20f0aa5e723635300bd9ba3a6dd836

Contents?: true

Size: 982 Bytes

Versions: 4

Compression:

Stored size: 982 Bytes

Contents

require "referer_tracking/engine"
require "referer_tracking/controller_addons"
require "referer_tracking/sweeper"

module RefererTracking

  mattr_accessor :save_cookies, :set_referer_cookies, :set_referer_cookies_name, :set_referer_cookies_first_url_max_length, :set_referer_cookies_ref_url_max_length

  self.save_cookies = true
  self.set_referer_cookies = true
  self.set_referer_cookies_name = 'ref_track'
  self.set_referer_cookies_first_url_max_length = 400
  self.set_referer_cookies_ref_url_max_length = 200

  def self.add_tracking_to(*models_list)
    models_list.each do |model|
      model.class_eval do
        include RefererTracking::TrackableModule
      end
    end

    RefererTracking::Sweeper.class_eval do
      observe models_list
    end
  end

  module TrackableModule
    def self.included(base)
      base.class_eval do
        has_one :referer_tracking, :class_name => "RefererTracking::RefererTracking", :as => :trackable
      end
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
referer_tracking-3.1.0 lib/referer_tracking.rb
referer_tracking-3.0.4 lib/referer_tracking.rb
referer_tracking-3.0.3 lib/referer_tracking.rb
referer_tracking-3.0.2 lib/referer_tracking.rb