lib/mongo_mapper/plugins/pagination/proxy.rb in mongo_mapper-unstable-2010.2.27 vs lib/mongo_mapper/plugins/pagination/proxy.rb in mongo_mapper-unstable-2010.2.28
- old
+ new
@@ -1,11 +1,11 @@
module MongoMapper
module Plugins
module Pagination
class Proxy
- instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|proxy_|^object_id$)/ }
-
+ instance_methods.each { |m| undef_method m unless m =~ /(^__|^nil\?$|^send$|respond_to\?|proxy_|^object_id$)/ }
+
attr_accessor :subject
attr_reader :total_entries, :per_page, :current_page
alias limit per_page
def initialize(total_entries, current_page, per_page=nil)
@@ -48,10 +48,14 @@
end
def method_missing(name, *args, &block)
@subject.send(name, *args, &block)
end
-
+
+ def respond_to?(name, *args, &block)
+ super || @subject.respond_to?(name, *args, &block)
+ end
+
private
def per_page=(value)
value = 25 if value.blank?
@per_page = value.to_i
end
\ No newline at end of file