Skip to content

Instantly share code, notes, and snippets.

@joshsusser
Created May 5, 2009 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshsusser/107168 to your computer and use it in GitHub Desktop.
Save joshsusser/107168 to your computer and use it in GitHub Desktop.
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment