Optimize impressionist_count query via arel count with distinct option
This commit is contained in:
1 parent
594889a3db
commit
fcfacdfdc9
2 files changed
+2
-5
No files matched your search
@@ -21,7 +21,7 @@ describe Impression do
|
||||
describe "#update_counter_cache" do
|
||||
it "should update the counter cache column to reflect the correct number of impressions" do
|
||||
lambda {
|
||||
Impression.create(:impressionable_type => @widget.class.name, :impressionable_id => @widget.id)
|
||||
@widget.impressions.create(:request_hash => 'abcd1234')
|
||||
@widget.reload
|
||||
}.should change(@widget, :impressions_count).from(0).to(1)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user