add init block support to #create and #create!
This commit is contained in:
parent
4e19fdfdda
commit
2b9a5193b4
|
@ -118,8 +118,8 @@ module CouchRest
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# returns the reloaded document
|
# returns the reloaded document
|
||||||
def create(attributes = {})
|
def create(attributes = {}, &block)
|
||||||
instance = new(attributes)
|
instance = new(attributes, &block)
|
||||||
instance.create
|
instance.create
|
||||||
instance
|
instance
|
||||||
end
|
end
|
||||||
|
@ -128,8 +128,8 @@ module CouchRest
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
# returns the reloaded document or raises an exception
|
# returns the reloaded document or raises an exception
|
||||||
def create!(attributes = {})
|
def create!(attributes = {}, &block)
|
||||||
instance = new(attributes)
|
instance = new(attributes, &block)
|
||||||
instance.create!
|
instance.create!
|
||||||
instance
|
instance
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue