Skip to content

Commit

Permalink
add init block support to #create and #create!
Browse files Browse the repository at this point in the history
  • Loading branch information
pezra committed May 31, 2011
1 parent 4e19fdf commit 2b9a519
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/couchrest/model/persistence.rb
Expand Up @@ -118,8 +118,8 @@ def build_from_database(doc = {})
#
# ==== Returns
# returns the reloaded document
def create(attributes = {})
instance = new(attributes)
def create(attributes = {}, &block)
instance = new(attributes, &block)
instance.create
instance
end
Expand All @@ -128,8 +128,8 @@ def create(attributes = {})
#
# ==== 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
Expand Down

0 comments on commit 2b9a519

Please sign in to comment.