From e1d140d8ae7e4a79c653cd457c0e36077e94e908 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Thu, 2 Dec 2010 01:53:45 +0100 Subject: [PATCH] Fixing the database in view bug --- history.txt | 1 + lib/couchrest/model/collection.rb | 3 +++ 2 files changed, 4 insertions(+) diff --git a/history.txt b/history.txt index becff4d..4f06656 100644 --- a/history.txt +++ b/history.txt @@ -8,6 +8,7 @@ * Fixing find("") issue (thanks epochwolf) * Altered protected attributes so that hash provided to #attributes= is not modified * Altering typecasting for floats to better handle commas and points + * Fixing the lame pagination bug where database url (and pass!!) were included in view requests (Thanks James Hayton) Notes: diff --git a/lib/couchrest/model/collection.rb b/lib/couchrest/model/collection.rb index 17910e7..f12c7ec 100644 --- a/lib/couchrest/model/collection.rb +++ b/lib/couchrest/model/collection.rb @@ -82,6 +82,7 @@ module CouchRest design_doc['views'][view_name.to_s] && design_doc['views'][view_name.to_s]["couchrest-defaults"]) || {} view_options = default_view_options.merge(options) + view_options.delete(:database) [design_doc, view_name, view_options] end @@ -94,6 +95,8 @@ module CouchRest raise ArgumentError, 'search_name is required' if search_name.nil? search_options = options.clone + search_options.delete(:database) + [design_doc, search_name, search_options] end