lib/will_paginate/finder.rb in will_paginate-2.3.16 vs lib/will_paginate/finder.rb in will_paginate-2.3.17
- old
+ new
@@ -95,11 +95,12 @@
# <tt>:order</tt> is <tt>"id"</tt>, override if necessary.
#
# See {Faking Cursors in ActiveRecord}[http://weblog.jamisbuck.org/2007/4/6/faking-cursors-in-activerecord]
# where Jamis Buck describes this and a more efficient way for MySQL.
def paginated_each(options = {})
- options = { :order => 'id', :page => 1 }.merge options
+ order = scope(:find, :order) || 'id'
+ options = { :order => order, :page => 1 }.merge options
options[:page] = options[:page].to_i
options[:total_entries] = 0 # skip the individual count queries
total = 0
begin
@@ -158,10 +159,14 @@
super || super(method.to_s.sub(/^paginate/, 'find'), include_priv)
end
end
protected
-
+
+ def respond_to_missing?(method, include_private = false)
+ method.to_s.index('paginate') == 0 || super
+ end
+
def method_missing_with_paginate(method, *args) #:nodoc:
# did somebody tried to paginate? if not, let them be
unless method.to_s.index('paginate') == 0
if block_given?
return method_missing_without_paginate(method, *args) { |*a| yield(*a) }