Rename instance method update_counter_cache => update_impressionist_counter_cache

This commit is contained in:
Ross Kaffenberger 2012-03-19 14:33:19 -04:00
parent 380f49cf62
commit 4c2c09ca69
3 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,7 @@ module Impressionist
imps.all.size imps.all.size
end end
def update_counter_cache def update_impressionist_counter_cache
cache_options = self.class.impressionist_counter_cache_options cache_options = self.class.impressionist_counter_cache_options
column_name = cache_options[:column_name].to_sym column_name = cache_options[:column_name].to_sym
count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count count = cache_options[:unique] ? impressionist_count(:filter => :ip_address) : impressionist_count

View File

@ -12,7 +12,7 @@ class Impression < ActiveRecord::Base
if impressionable_class.impressionist_counter_cache_options if impressionable_class.impressionist_counter_cache_options
resouce = impressionable_class.find(self.impressionable_id) resouce = impressionable_class.find(self.impressionable_id)
resouce.try(:update_counter_cache) resouce.try(:update_impressionist_counter_cache)
end end
end end
end end

View File

@ -18,7 +18,7 @@ describe Impression do
end end
end end
describe "#update_counter_cache" do describe "#update_impressionist_counter_cache" do
it "should update the counter cache column to reflect the correct number of impressions" do it "should update the counter cache column to reflect the correct number of impressions" do
lambda { lambda {
Impression.create(:impressionable_type => @widget.class.name, :impressionable_id => @widget.id) Impression.create(:impressionable_type => @widget.class.name, :impressionable_id => @widget.id)