dm-core 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ AUTHOR = "Sam Smoot"
13
13
  EMAIL = "ssmoot@gmail.com"
14
14
  GEM_NAME = "dm-core"
15
15
  GEM_VERSION = DataMapper::VERSION
16
- GEM_DEPENDENCIES = ["data_objects", GEM_VERSION], ["extlib", "=0.9.4"],
16
+ GEM_DEPENDENCIES = ["data_objects", ">=0.9.5"], ["extlib", ">=0.9.5"],
17
17
  ["rspec", ">=1.1.3"], ["addressable", ">=1.0.4"]
18
18
 
19
19
 
data/lib/dm-core.rb CHANGED
@@ -20,7 +20,7 @@ require 'rubygems'
20
20
  gem 'addressable', '>=1.0.4'
21
21
  require 'addressable/uri'
22
22
 
23
- gem 'extlib', '=0.9.4'
23
+ gem 'extlib', '>=0.9.5'
24
24
  require 'extlib'
25
25
 
26
26
  begin
@@ -1,4 +1,4 @@
1
- gem 'data_objects', '=0.9.4'
1
+ gem 'data_objects', '=0.9.5'
2
2
  require 'data_objects'
3
3
 
4
4
  module DataMapper
@@ -265,7 +265,7 @@ module DataMapper
265
265
 
266
266
  statement = ''
267
267
 
268
- query.links.each do |relationship|
268
+ query.links.reverse.each do |relationship|
269
269
  parent_table_name = relationship.parent_model.storage_name(query.repository.name)
270
270
  child_table_name = relationship.child_model.storage_name(query.repository.name)
271
271
 
@@ -1,4 +1,4 @@
1
- gem 'do_mysql', '=0.9.4'
1
+ gem 'do_mysql', '=0.9.5'
2
2
  require 'do_mysql'
3
3
 
4
4
  module DataMapper
@@ -1,4 +1,4 @@
1
- gem 'do_postgres', '=0.9.4'
1
+ gem 'do_postgres', '=0.9.5'
2
2
  require 'do_postgres'
3
3
 
4
4
  module DataMapper
@@ -1,4 +1,4 @@
1
- gem 'do_sqlite3', '=0.9.4'
1
+ gem 'do_sqlite3', '=0.9.5'
2
2
  require 'do_sqlite3'
3
3
 
4
4
  module DataMapper
data/lib/dm-core/model.rb CHANGED
@@ -148,7 +148,7 @@ module DataMapper
148
148
  create_property_getter(property)
149
149
  create_property_setter(property)
150
150
 
151
- @properties[repository_name] << property
151
+ @properties[repository_name][property.name] = property
152
152
 
153
153
  # Add property to the other mappings as well if this is for the default
154
154
  # repository.
@@ -7,6 +7,16 @@ module DataMapper
7
7
  @property_for[name] || raise(ArgumentError, "Unknown property '#{name}'", caller)
8
8
  end
9
9
 
10
+ def []=(name, property)
11
+ if existing_property = detect { |p| p.name == name }
12
+ property.hash
13
+ @entries[@entries.index(existing_property)] = property
14
+ else
15
+ add(property)
16
+ end
17
+ property
18
+ end
19
+
10
20
  def has_property?(name)
11
21
  !!@property_for[name]
12
22
  end
@@ -1,3 +1,3 @@
1
1
  module DataMapper
2
- VERSION = '0.9.4' unless defined?(DataMapper::VERSION)
2
+ VERSION = '0.9.5' unless defined?(DataMapper::VERSION)
3
3
  end
@@ -416,7 +416,7 @@ if ADAPTER
416
416
  a = Area.new(:machine_id => m.id)
417
417
  a.machine.should == m
418
418
  end
419
-
419
+
420
420
  it "should not have a machine when orphaned" do
421
421
  a = Area.new(:machine_id => 42)
422
422
  a.machine.should be_nil
@@ -1168,6 +1168,11 @@ if ADAPTER
1168
1168
  # misc
1169
1169
  #
1170
1170
 
1171
+ it 'should join tables in the right order during has 1 => has n => has 1 queries' do
1172
+ child = Sweets::Shop.first.children(:name => 'Snotling nr 3').booger(:name.like => 'ooger')
1173
+ child.should_not be_nil
1174
+ end
1175
+
1171
1176
  it 'should raise exception if you try to change it' do
1172
1177
  lambda do
1173
1178
  Sweets::Shop.first.wife = Sweets::Wife.new(:name => 'Larry')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Smoot
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-21 00:00:00 -05:00
12
+ date: 2008-08-26 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,9 +18,9 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "="
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 0.9.4
23
+ version: 0.9.5
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: extlib
@@ -28,9 +28,9 @@ dependencies:
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "="
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.9.4
33
+ version: 0.9.5
34
34
  version:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rspec