-
-
Save lifo/47104a3bda7f48e8ac70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/will_paginate/finder.rb b/lib/will_paginate/finder.rb | |
index b80602b..c2de266 100644 | |
--- a/lib/will_paginate/finder.rb | |
+++ b/lib/will_paginate/finder.rb | |
@@ -194,7 +194,9 @@ module WillPaginate | |
klass = (@owner and @reflection) ? @reflection.klass : self | |
# Use :select from scope if it isn't already present. | |
- options[:select] = scope(:find, :select) unless options[:select] | |
+ if options[:select].blank? && current_scoped_methods && current_scoped_methods.select_values.present? | |
+ options[:select] = current_scoped_methods.select_values.join(", ") | |
+ end | |
if options[:select] and options[:select] =~ /^\s*DISTINCT\b/i | |
# Remove quoting and check for table_name.*-like statement. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment