lib/restful_resource/base.rb in restful_resource-0.9.4 vs lib/restful_resource/base.rb in restful_resource-0.9.5

- old
+ new

@@ -66,9 +66,22 @@ def self.action_prefix=(action_prefix) @action_prefix = action_prefix.to_s end + def self.fetch_all!(conditions={}) + Enumerator.new do |y| + next_page = 1 + begin + resources = self.where(conditions.merge(page: next_page)) + resources.each do |resource| + y << resource + end + next_page = resources.next_page + end while(!next_page.nil?) + end + end + protected def self.http @http || superclass.http end