fixed a typo in the previous commit
This commit is contained in:
parent
d383c5a7d4
commit
7455152f63
3 changed files with 22 additions and 7 deletions
|
@ -22,12 +22,13 @@ $:.unshift File.dirname(__FILE__) unless
|
|||
$:.include?(File.dirname(__FILE__)) ||
|
||||
$:.include?(File.expand_path(File.dirname(__FILE__)))
|
||||
|
||||
$COUCHREST_DEBUG ||= false
|
||||
|
||||
require 'couchrest/monkeypatches'
|
||||
|
||||
# = CouchDB, close to the metal
|
||||
module CouchRest
|
||||
VERSION = '0.17' unless self.const_defined?("VERSION")
|
||||
VERSION = '0.17' unless self.const_defined?("VERSION")
|
||||
|
||||
autoload :Server, 'couchrest/core/server'
|
||||
autoload :Database, 'couchrest/core/database'
|
||||
|
@ -129,7 +130,11 @@ module CouchRest
|
|||
begin
|
||||
JSON.parse(RestClient.put(uri, payload))
|
||||
rescue Exception => e
|
||||
raise "Error while sending a PUT request #{uri}\npayload: #{payload.inspect}\n#{e}"
|
||||
if $COUCHREST_DEBUG == true
|
||||
raise "Error while sending a PUT request #{uri}\npayload: #{payload.inspect}\n#{e}"
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -137,7 +142,11 @@ module CouchRest
|
|||
begin
|
||||
JSON.parse(RestClient.get(uri), :max_nesting => false)
|
||||
rescue => e
|
||||
raise "Error while sending a GET request #{uri}\n: #{e}"
|
||||
if $COUCHREST_DEBUG == true
|
||||
raise "Error while sending a GET request #{uri}\n: #{e}"
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -146,7 +155,11 @@ module CouchRest
|
|||
begin
|
||||
JSON.parse(RestClient.post(uri, payload))
|
||||
rescue Exception => e
|
||||
raise "Error while sending a POST request #{uri}\npayload: #{payload.inspect}\n#{e}"
|
||||
if $COUCHREST_DEBUG == true
|
||||
raise "Error while sending a POST request #{uri}\npayload: #{payload.inspect}\n#{e}"
|
||||
else
|
||||
raise e
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -133,9 +133,8 @@ module CouchRest
|
|||
fetch_view(name, opts, &block)
|
||||
else
|
||||
begin
|
||||
# auto load mentioned documents unless asked differently
|
||||
opts.merge({:include_docs => true}) unless opts.has_key?(:include_docs)
|
||||
view = fetch_view name, opts, &block
|
||||
# auto load mentioned documents unless asked differently (didn't use merge! on a previous line to avoid duping the object)
|
||||
view = fetch_view name, (opts.has_key?(:include_docs) ? opts : opts.merge({:include_docs => true})), &block
|
||||
view['rows'].collect{|r|new(r['doc'])} if view['rows']
|
||||
rescue
|
||||
# fallback for old versions of couchdb that don't
|
||||
|
|
|
@ -105,6 +105,9 @@ describe "ExtendedDocument views" do
|
|||
|
||||
describe "a model with a compound key view" do
|
||||
before(:all) do
|
||||
Article.design_doc_fresh = false
|
||||
Article.by_user_id_and_date.each{|a| a.destroy(true)}
|
||||
Article.database.bulk_delete
|
||||
written_at = Time.now - 24 * 3600 * 7
|
||||
@titles = ["uniq one", "even more interesting", "less fun", "not junk"]
|
||||
@user_ids = ["quentin", "aaron"]
|
||||
|
|
Loading…
Reference in a new issue