lib/will_paginate/finder.rb in will_paginate-2.3.14 vs lib/will_paginate/finder.rb in will_paginate-2.3.15

- old
+ new

@@ -153,11 +153,11 @@ def respond_to?(method, include_priv = false) #:nodoc: case method.to_sym when :paginate, :paginate_by_sql true else - super(method.to_s.sub(/^paginate/, 'find'), include_priv) + super || super(method.to_s.sub(/^paginate/, 'find'), include_priv) end end protected @@ -196,11 +196,11 @@ # Use :select from scope if it isn't already present. options[:select] = scope(:find, :select) unless options[:select] if options[:select] and options[:select] =~ /^\s*DISTINCT\b/i # Remove quoting and check for table_name.*-like statement. - if options[:select].gsub('`', '') =~ /\w+\.\*/ + if options[:select].gsub(/[`"]/, '') =~ /\w+\.\*/ options[:select] = "DISTINCT #{klass.table_name}.#{klass.primary_key}" end else excludees << :select # only exclude the select param if it doesn't begin with DISTINCT end @@ -233,10 +233,10 @@ with_scope(:find => { :conditions => conditions }, &counter) else counter.call end - count.respond_to?(:length) ? count.length : count + (!count.is_a?(Integer) && count.respond_to?(:length)) ? count.length : count end def wp_parse_options(options) #:nodoc: raise ArgumentError, 'parameter hash expected' unless options.respond_to? :symbolize_keys options = options.symbolize_keys