Permalink
Browse files

Merge branch 'next' of git://github.com/datamapper/dm-core into next

  • Loading branch information...
2 parents edf1619 + 81015c0 commit b9fa3ceae4b1b1613c6dfe7a6451f0ceebe5fe34 @godfat committed Jun 8, 2009
Showing with 7 additions and 5 deletions.
  1. +1 −1 lib/dm-core.rb
  2. +1 −1 lib/dm-core/adapters/data_objects_adapter.rb
  3. +5 −3 lib/dm-core/model.rb
View
@@ -180,7 +180,7 @@ def self.setup(*args)
options = normalize_options(uri_or_options)
adapter_name = options[:adapter]
- class_name = (Extlib::Inflection.classify(adapter_name) + 'Adapter').to_sym
+ class_name = (Extlib::Inflection.camelize(adapter_name) + 'Adapter').to_sym
unless Adapters.const_defined?(class_name)
lib_name = "#{adapter_name}_adapter"
@@ -439,7 +439,7 @@ def join_statement(query, qualify)
statement = ''
- query.links.reverse_each do |relationship|
+ query.links[0..-1].reverse_each do |relationship|
model = if relationship.source_model == previous_model
relationship.target_model
else
@@ -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
@@ -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
@@ -312,7 +312,7 @@ def new(attributes = {})
model ||= self
resource = model.allocate
- resource.send(:initialize, attributes)
+ resource.send(:initialize, attributes, &block)
resource
end
@@ -452,6 +452,8 @@ def load(records, query)
value = record[property]
+ # TODO: typecasting should happen inside the Adapter
+ # and all values should come back as expected objects
if property.custom?
value = property.type.load(value, property)
end

0 comments on commit b9fa3ce

Please sign in to comment.