From 2b9a5193b43b60694637a1f71d9d976150c15caa Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 31 May 2011 16:03:08 -0600 Subject: [PATCH] add init block support to #create and #create! --- lib/couchrest/model/persistence.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/couchrest/model/persistence.rb b/lib/couchrest/model/persistence.rb index e77b6630..21f64556 100644 --- a/lib/couchrest/model/persistence.rb +++ b/lib/couchrest/model/persistence.rb @@ -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 @@ -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