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