Skip to content
This repository has been archived by the owner on Apr 17, 2018. It is now read-only.

Commit

Permalink
Make sure to pass the block to #initialize.
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Kubb <dan.kubb@gmail.com>
  • Loading branch information
postmodern authored and dkubb committed Jun 7, 2009
1 parent 716a689 commit 81015c0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/dm-core/model.rb
Expand Up @@ -36,7 +36,7 @@ def self.default_storage_name
RUBY
end

model.instance_eval(&block) if block_given?
model.instance_eval(&block) if block
model
end

Expand Down Expand Up @@ -302,7 +302,7 @@ def first_or_create(conditions = {}, attributes = {})
# the newly initialized Resource instance
#
# @api public
def new(attributes = {})
def new(attributes = {}, &block)
assert_valid

model = if discriminator = properties(repository_name).discriminator
Expand All @@ -312,7 +312,7 @@ def new(attributes = {})
model ||= self

resource = model.allocate
resource.send(:initialize, attributes)
resource.send(:initialize, attributes, &block)
resource
end

Expand Down

0 comments on commit 81015c0

Please sign in to comment.