diff --git a/lib/couchrest/more/extended_document.rb b/lib/couchrest/more/extended_document.rb index cce0d89..73c1b17 100644 --- a/lib/couchrest/more/extended_document.rb +++ b/lib/couchrest/more/extended_document.rb @@ -41,7 +41,7 @@ module CouchRest def initialize(passed_keys={}) apply_defaults # defined in CouchRest::Mixins::Properties - set_attributes(passed_keys) + set_attributes(passed_keys) unless passed_keys.nil? super cast_keys # defined in CouchRest::Mixins::Properties unless self['_id'] && self['_rev'] diff --git a/spec/couchrest/more/extended_doc_spec.rb b/spec/couchrest/more/extended_doc_spec.rb index 1f91dcf..f055576 100644 --- a/spec/couchrest/more/extended_doc_spec.rb +++ b/spec/couchrest/more/extended_doc_spec.rb @@ -129,6 +129,11 @@ describe "ExtendedDocument" do @obj.should be_new_document @obj.should be_new_record end + + it "should not failed on a nil value in argument" do + @obj = Basic.new(nil) + @obj.should == { 'couchrest-type' => 'Basic' } + end end describe "creating a new document" do