lib/ripple/document/persistence.rb in ripple-0.9.0.beta vs lib/ripple/document/persistence.rb in ripple-0.9.0.beta2

- old
+ new

@@ -68,25 +68,27 @@ end # Saves the document in Riak. # @return [true,false] whether the document succeeded in saving def save(*args) + really_save(*args) + end + + def really_save(*args) robject.key = key if robject.key != key robject.data = attributes_for_persistence robject.store(self.class.quorums.slice(:w,:dw)) self.key = robject.key @new = false true - rescue Riak::FailedRequest - false end # Reloads the document from Riak # @return self def reload return self if new? robject.reload(:force => true) - @robject.data.except("_type").each { |key, value| send("#{key}=", value) } + self.__send__(:attributes=, @robject.data.except("_type"), false) self end # Deletes the document from Riak and freezes this instance def destroy