Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fixed count method to handle result from grouped relations. #209

Closed
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+3 −1
Split
@@ -65,7 +65,9 @@ def count
rel = self.except(*excluded)
# TODO: hack. decide whether to keep
rel = rel.apply_finder_options(@wp_count_options) if defined? @wp_count_options
- rel.count
+ result = rel.count
+ # TODO: hack. handle count result returned by grouped relation
+ result.is_a?(Hash) ? result.values.reduce(&:+) : result
else
super
end