Skip to content

Commit

Permalink
Save on Document & ExtendedDocument crashed if bulk
Browse files Browse the repository at this point in the history
- document#save expects to receive {"ok" => true} even with bulk mode
- ExtendedDocument#save_without_callbacks reverted to previous code
  (expecting result["ok"] as in create_without_callbacks)
  • Loading branch information
Julien Sanchez committed Oct 12, 2009
1 parent 54dee07 commit 36f5f83
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/couchrest/core/database.rb
Expand Up @@ -145,7 +145,7 @@ def save_doc(doc, bulk = false)
end
if bulk
@bulk_save_cache << doc
return bulk_save if @bulk_save_cache.length >= @bulk_save_cache_limit
bulk_save if @bulk_save_cache.length >= @bulk_save_cache_limit
return {"ok" => true} # Compatibility with Document#save
elsif !bulk && @bulk_save_cache.length > 0
bulk_save
Expand Down
2 changes: 1 addition & 1 deletion lib/couchrest/more/extended_document.rb
Expand Up @@ -238,7 +238,7 @@ def save_without_callbacks(bulk = false)
set_unique_id if new? && self.respond_to?(:set_unique_id)
result = database.save_doc(self, bulk)
mark_as_saved
true
result["ok"] == true
end

# Saves the document to the db using save. Raises an exception
Expand Down

1 comment on commit 36f5f83

@tapajos
Copy link

@tapajos tapajos commented on 36f5f83 Jan 4, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this commit but I need to write some tests before merge it. I will do it as soon as possible(I'm very busy this week).
Can you help me and write this tests?

Please sign in to comment.