add init block support to #create and #create!

This commit is contained in:
Peter Williams 2011-05-31 16:03:08 -06:00
parent 4e19fdfdda
commit 2b9a5193b4

View file

@ -118,8 +118,8 @@ module CouchRest
#
# ==== Returns
# returns the reloaded document
def create(attributes = {})
instance = new(attributes)
def create(attributes = {}, &block)
instance = new(attributes, &block)
instance.create
instance
end
@ -128,8 +128,8 @@ module CouchRest
#
# ==== Returns
# returns the reloaded document or raises an exception
def create!(attributes = {})
instance = new(attributes)
def create!(attributes = {}, &block)
instance = new(attributes, &block)
instance.create!
instance
end