app/models/page_view.rb in e9_crm-0.1.21 vs app/models/page_view.rb in e9_crm-0.1.22
- old
+ new
@@ -12,19 +12,20 @@
# [remote_ip] The originating ip address of the request
# [session] The session id of the request
#
class PageView < ActiveRecord::Base
include E9Rails::ActiveRecord::Scopes::Times
+ include E9::ActiveRecord::TimeScopes
belongs_to :tracking_cookie
belongs_to :campaign, :inverse_of => :page_views
has_one :user, :through => :tracking_cookie
- attr_accessor :should_cache
+ #attr_accessor :should_cache
- after_create :increment_campaign_visit_cache, :if => '!!should_cache'
+ #after_create :increment_campaign_visit_cache, :if => '!!should_cache'
scope :by_user, lambda {|*users|
users.flatten!
users.map! &:to_param
joins(:tracking_cookie).where(TrackingCookie.arel_table[:user_id].send *(users.length == 1 ? [:eq, users.pop] : [:in, users]))
@@ -41,9 +42,9 @@
delegate :name, :code, :to => :campaign, :prefix => true, :allow_nil => true
protected
- def increment_campaign_visit_cache
- Campaign.increment_counter(new_visit ? :new_visits : :repeat_visits, campaign_id)
- end
+ #def increment_campaign_visit_cache
+ #Campaign.increment_counter(new_visit ? :new_visits : :repeat_visits, campaign_id)
+ #end
end