Skip to content

Instantly share code, notes, and snippets.

@lifo
Created January 16, 2010 19:10
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 lifo/47104a3bda7f48e8ac70 to your computer and use it in GitHub Desktop.
Save lifo/47104a3bda7f48e8ac70 to your computer and use it in GitHub Desktop.
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