Commit e3bb91477ff6395c1e9fcf8a1b1edbbf38243c07
1 parent
caf7b511
Exists in
master
and in
11 other branches
rails4: fix count with distinct monkey patch
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
lib/noosfero/core_ext/active_record.rb
... | ... | @@ -67,9 +67,9 @@ class ActiveRecord::Base |
67 | 67 | |
68 | 68 | end |
69 | 69 | |
70 | -ActiveRecord::Calculations.module_eval do | |
71 | - def count_with_default_distinct(column_name=:id, options={}) | |
72 | - count_without_default_distinct(column_name, {:distinct => true}.merge(options)) | |
70 | +ActiveRecord::Calculations.class_eval do | |
71 | + def count_with_distinct column_name=:id, options={} | |
72 | + distinct.count_without_distinct column_name, options | |
73 | 73 | end |
74 | - alias_method_chain :count, :default_distinct | |
74 | + alias_method_chain :count, :distinct | |
75 | 75 | end | ... | ... |