joshsusser (owner)

Revisions

gist: 107168 Download_button fork
public
Public Clone URL: git://gist.github.com/107168.git
Embed All Files: show embed
count_fix.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
# drop this in config/initializers/count_fix.rb to work around
# hmt/named_scope count bug https://rails.lighthouseapp.com/projects/8994/tickets/2189
 
class ActiveRecord::Base
  protected
    def self.construct_count_options_from_args(*args)
      name_and_options = super
      name_and_options[0] = '*' if name_and_options[0].is_a?(String) && name_and_options[0] =~ /\.\*$/
      name_and_options
    end
end