sam-dm-core 0.9.10 → 0.9.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/History.txt +10 -0
- data/MIT-LICENSE +1 -1
- data/Rakefile +4 -4
- data/dm-core.gemspec +40 -0
- data/lib/dm-core.rb +1 -1
- data/lib/dm-core/adapters/data_objects_adapter.rb +2 -2
- data/lib/dm-core/adapters/in_memory_adapter.rb +87 -0
- data/lib/dm-core/adapters/mysql_adapter.rb +1 -1
- data/lib/dm-core/adapters/postgres_adapter.rb +1 -1
- data/lib/dm-core/adapters/sqlite3_adapter.rb +1 -1
- data/lib/dm-core/associations/many_to_one.rb +1 -1
- data/lib/dm-core/associations/one_to_many.rb +18 -18
- data/lib/dm-core/associations/relationship.rb +9 -3
- data/lib/dm-core/associations/relationship_chain.rb +1 -1
- data/lib/dm-core/collection.rb +3 -3
- data/lib/dm-core/model.rb +5 -4
- data/lib/dm-core/resource.rb +11 -5
- data/lib/dm-core/version.rb +1 -1
- data/script/all +3 -4
- data/spec/integration/association_spec.rb +18 -18
- data/spec/integration/association_through_spec.rb +4 -4
- data/spec/integration/associations/many_to_many_spec.rb +9 -9
- data/spec/integration/associations/many_to_one_spec.rb +1 -1
- data/spec/integration/associations/one_to_many_spec.rb +3 -3
- data/spec/integration/collection_spec.rb +2 -2
- data/spec/integration/dependency_queue_spec.rb +1 -1
- data/spec/integration/model_spec.rb +1 -1
- data/spec/integration/mysql_adapter_spec.rb +1 -1
- data/spec/integration/postgres_adapter_spec.rb +16 -16
- data/spec/integration/property_spec.rb +10 -6
- data/spec/integration/query_spec.rb +4 -4
- data/spec/integration/repository_spec.rb +1 -1
- data/spec/integration/sqlite3_adapter_spec.rb +7 -7
- data/spec/integration/sti_spec.rb +6 -6
- data/spec/integration/strategic_eager_loading_spec.rb +14 -11
- data/spec/integration/type_spec.rb +10 -6
- data/spec/lib/logging_helper.rb +11 -11
- data/spec/models/content.rb +16 -0
- data/spec/spec_helper.rb +8 -4
- data/spec/unit/adapters/data_objects_adapter_spec.rb +9 -5
- data/spec/unit/adapters/in_memory_adapter_spec.rb +98 -0
- data/spec/unit/adapters/postgres_adapter_spec.rb +5 -5
- data/spec/unit/associations/many_to_many_spec.rb +2 -2
- data/spec/unit/associations/many_to_one_spec.rb +3 -3
- data/spec/unit/associations/one_to_many_spec.rb +2 -2
- data/spec/unit/associations/relationship_spec.rb +6 -6
- data/spec/unit/associations_spec.rb +21 -21
- data/spec/unit/identity_map_spec.rb +3 -3
- data/spec/unit/is_spec.rb +7 -7
- data/spec/unit/property_spec.rb +7 -7
- data/spec/unit/resource_spec.rb +12 -12
- data/spec/unit/transaction_spec.rb +1 -1
- data/tasks/dm.rb +1 -1
- metadata +10 -5
data/lib/dm-core/model.rb
CHANGED
@@ -388,8 +388,9 @@ module DataMapper
|
|
388
388
|
# TODO: add docs
|
389
389
|
# @api private
|
390
390
|
def _load(marshalled)
|
391
|
-
|
392
|
-
|
391
|
+
resource = allocate
|
392
|
+
Marshal.load(marshalled).each { |kv| resource.instance_variable_set(*kv) }
|
393
|
+
resource
|
393
394
|
end
|
394
395
|
|
395
396
|
def typecast_key(key)
|
@@ -442,7 +443,7 @@ module DataMapper
|
|
442
443
|
end
|
443
444
|
EOS
|
444
445
|
|
445
|
-
if property.primitive == TrueClass && !instance_methods.include?(property.name.to_s)
|
446
|
+
if property.primitive == TrueClass && !instance_methods.map { |m| m.to_s }.include?(property.name.to_s)
|
446
447
|
class_eval <<-EOS, __FILE__, __LINE__
|
447
448
|
#{property.reader_visibility}
|
448
449
|
alias #{property.name} #{property.getter}
|
@@ -452,7 +453,7 @@ module DataMapper
|
|
452
453
|
|
453
454
|
# defines the setter for the property
|
454
455
|
def create_property_setter(property)
|
455
|
-
unless instance_methods.include?("#{property.name}=")
|
456
|
+
unless instance_methods.map { |m| m.to_s }.include?("#{property.name}=")
|
456
457
|
class_eval <<-EOS, __FILE__, __LINE__
|
457
458
|
#{property.writer_visibility}
|
458
459
|
def #{property.name}=(value)
|
data/lib/dm-core/resource.rb
CHANGED
@@ -531,14 +531,20 @@ module DataMapper
|
|
531
531
|
# TODO: add docs
|
532
532
|
# @api private
|
533
533
|
def _dump(*)
|
534
|
-
|
535
|
-
attributes = {}
|
534
|
+
ivars = {}
|
536
535
|
|
537
|
-
|
538
|
-
|
536
|
+
# dump all the loaded properties
|
537
|
+
properties.each do |property|
|
538
|
+
next unless attribute_loaded?(property.name)
|
539
|
+
ivars[property.instance_variable_name] = property.get!(self)
|
540
|
+
end
|
541
|
+
|
542
|
+
# dump ivars used internally
|
543
|
+
%w[ @new_record @original_values @readonly @repository ].each do |name|
|
544
|
+
ivars[name] = instance_variable_get(name)
|
539
545
|
end
|
540
546
|
|
541
|
-
Marshal.dump(
|
547
|
+
Marshal.dump(ivars)
|
542
548
|
end
|
543
549
|
|
544
550
|
protected
|
data/lib/dm-core/version.rb
CHANGED
data/script/all
CHANGED
@@ -9,7 +9,7 @@ if HAS_SQLITE3
|
|
9
9
|
FileUtils.touch(db2)
|
10
10
|
DataMapper.setup(:custom_db1, "sqlite3://#{db1}")
|
11
11
|
DataMapper.setup(:custom_db2, "sqlite3://#{db2}")
|
12
|
-
class CustomParent
|
12
|
+
class ::CustomParent
|
13
13
|
include DataMapper::Resource
|
14
14
|
def self.default_repository_name
|
15
15
|
:custom_db1
|
@@ -20,7 +20,7 @@ if HAS_SQLITE3
|
|
20
20
|
has n, :custom_childs
|
21
21
|
end
|
22
22
|
end
|
23
|
-
class CustomChild
|
23
|
+
class ::CustomChild
|
24
24
|
include DataMapper::Resource
|
25
25
|
def self.default_repository_name
|
26
26
|
:custom_db2
|
@@ -70,7 +70,7 @@ end
|
|
70
70
|
|
71
71
|
if ADAPTER
|
72
72
|
repository(ADAPTER) do
|
73
|
-
class Machine
|
73
|
+
class ::Machine
|
74
74
|
include DataMapper::Resource
|
75
75
|
|
76
76
|
def self.default_repository_name
|
@@ -84,7 +84,7 @@ if ADAPTER
|
|
84
84
|
has n, :fussy_areas, :class_name => 'Area', :rating.gte => 3, :type => 'particular'
|
85
85
|
end
|
86
86
|
|
87
|
-
class Area
|
87
|
+
class ::Area
|
88
88
|
include DataMapper::Resource
|
89
89
|
|
90
90
|
def self.default_repository_name
|
@@ -99,7 +99,7 @@ if ADAPTER
|
|
99
99
|
belongs_to :machine
|
100
100
|
end
|
101
101
|
|
102
|
-
class Pie
|
102
|
+
class ::Pie
|
103
103
|
include DataMapper::Resource
|
104
104
|
|
105
105
|
def self.default_repository_name
|
@@ -112,7 +112,7 @@ if ADAPTER
|
|
112
112
|
belongs_to :sky
|
113
113
|
end
|
114
114
|
|
115
|
-
class Sky
|
115
|
+
class ::Sky
|
116
116
|
include DataMapper::Resource
|
117
117
|
|
118
118
|
def self.default_repository_name
|
@@ -125,7 +125,7 @@ if ADAPTER
|
|
125
125
|
has 1, :pie
|
126
126
|
end
|
127
127
|
|
128
|
-
class Ultrahost
|
128
|
+
class ::Ultrahost
|
129
129
|
include DataMapper::Resource
|
130
130
|
|
131
131
|
def self.default_repository_name
|
@@ -138,7 +138,7 @@ if ADAPTER
|
|
138
138
|
has n, :ultraslices, :order => [:id.desc]
|
139
139
|
end
|
140
140
|
|
141
|
-
class Ultraslice
|
141
|
+
class ::Ultraslice
|
142
142
|
include DataMapper::Resource
|
143
143
|
|
144
144
|
def self.default_repository_name
|
@@ -151,7 +151,7 @@ if ADAPTER
|
|
151
151
|
belongs_to :ultrahost
|
152
152
|
end
|
153
153
|
|
154
|
-
class Node
|
154
|
+
class ::Node
|
155
155
|
include DataMapper::Resource
|
156
156
|
|
157
157
|
def self.default_repository_name
|
@@ -165,7 +165,7 @@ if ADAPTER
|
|
165
165
|
belongs_to :parent, :class_name => 'Node', :child_key => [ :parent_id ]
|
166
166
|
end
|
167
167
|
|
168
|
-
class MadeUpThing
|
168
|
+
class ::MadeUpThing
|
169
169
|
include DataMapper::Resource
|
170
170
|
|
171
171
|
def self.default_repository_name
|
@@ -178,7 +178,7 @@ if ADAPTER
|
|
178
178
|
belongs_to :machine
|
179
179
|
end
|
180
180
|
|
181
|
-
module Models
|
181
|
+
module ::Models
|
182
182
|
class Project
|
183
183
|
include DataMapper::Resource
|
184
184
|
|
@@ -220,7 +220,7 @@ if ADAPTER
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
-
class Galaxy
|
223
|
+
class ::Galaxy
|
224
224
|
include DataMapper::Resource
|
225
225
|
|
226
226
|
def self.default_repository_name
|
@@ -231,7 +231,7 @@ if ADAPTER
|
|
231
231
|
property :size, Float, :key => true, :precision => 15, :scale => 6
|
232
232
|
end
|
233
233
|
|
234
|
-
class Star
|
234
|
+
class ::Star
|
235
235
|
include DataMapper::Resource
|
236
236
|
|
237
237
|
def self.default_repository_name
|
@@ -303,7 +303,7 @@ if ADAPTER
|
|
303
303
|
end
|
304
304
|
|
305
305
|
it 'should create the foreign key property immediately' do
|
306
|
-
class Duck
|
306
|
+
class ::Duck
|
307
307
|
include DataMapper::Resource
|
308
308
|
property :id, Serial
|
309
309
|
belongs_to :sky
|
@@ -334,7 +334,7 @@ if ADAPTER
|
|
334
334
|
|
335
335
|
it '#belongs_to with namespaced models' do
|
336
336
|
repository(ADAPTER) do
|
337
|
-
module FlightlessBirds
|
337
|
+
module ::FlightlessBirds
|
338
338
|
class Ostrich
|
339
339
|
include DataMapper::Resource
|
340
340
|
property :id, Serial
|
@@ -728,7 +728,7 @@ if ADAPTER
|
|
728
728
|
describe 'through-associations' do
|
729
729
|
before :all do
|
730
730
|
repository(ADAPTER) do
|
731
|
-
module Sweets
|
731
|
+
module ::Sweets
|
732
732
|
class Shop
|
733
733
|
include DataMapper::Resource
|
734
734
|
def self.default_repository_name
|
@@ -1219,7 +1219,7 @@ if ADAPTER
|
|
1219
1219
|
if false # Many to many not yet implemented
|
1220
1220
|
describe "many to many associations" do
|
1221
1221
|
before(:all) do
|
1222
|
-
class RightItem
|
1222
|
+
class ::RightItem
|
1223
1223
|
include DataMapper::Resource
|
1224
1224
|
|
1225
1225
|
def self.default_repository_name
|
@@ -1232,7 +1232,7 @@ if ADAPTER
|
|
1232
1232
|
has n..n, :left_items
|
1233
1233
|
end
|
1234
1234
|
|
1235
|
-
class LeftItem
|
1235
|
+
class ::LeftItem
|
1236
1236
|
include DataMapper::Resource
|
1237
1237
|
|
1238
1238
|
def self.default_repository_name
|
@@ -4,7 +4,7 @@ if ADAPTER
|
|
4
4
|
describe 'through-associations' do
|
5
5
|
before :all do
|
6
6
|
repository(ADAPTER) do
|
7
|
-
class Tag
|
7
|
+
class ::Tag
|
8
8
|
include DataMapper::Resource
|
9
9
|
def self.default_repository_name
|
10
10
|
ADAPTER
|
@@ -22,7 +22,7 @@ if ADAPTER
|
|
22
22
|
has n, :posts, :through => :taggings
|
23
23
|
end
|
24
24
|
|
25
|
-
class Tagging
|
25
|
+
class ::Tagging
|
26
26
|
include DataMapper::Resource
|
27
27
|
def self.default_repository_name
|
28
28
|
ADAPTER
|
@@ -35,7 +35,7 @@ if ADAPTER
|
|
35
35
|
belongs_to :tag
|
36
36
|
end
|
37
37
|
|
38
|
-
class Post
|
38
|
+
class ::Post
|
39
39
|
include DataMapper::Resource
|
40
40
|
def self.default_repository_name
|
41
41
|
ADAPTER
|
@@ -61,7 +61,7 @@ if ADAPTER
|
|
61
61
|
Post.taggings.tag.voided => true
|
62
62
|
end
|
63
63
|
|
64
|
-
class Relationship
|
64
|
+
class ::Relationship
|
65
65
|
include DataMapper::Resource
|
66
66
|
def self.default_repository_name
|
67
67
|
ADAPTER
|
@@ -2,7 +2,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_hel
|
|
2
2
|
|
3
3
|
describe DataMapper::Associations::ManyToMany::Proxy do
|
4
4
|
before :all do
|
5
|
-
class Editor
|
5
|
+
class ::Editor
|
6
6
|
include DataMapper::Resource
|
7
7
|
|
8
8
|
def self.default_repository_name; ADAPTER end
|
@@ -15,7 +15,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
15
15
|
|
16
16
|
Object.send(:remove_const, :Book) if defined?(Book)
|
17
17
|
|
18
|
-
class Book
|
18
|
+
class ::Book
|
19
19
|
include DataMapper::Resource
|
20
20
|
|
21
21
|
def self.default_repository_name; ADAPTER end
|
@@ -190,7 +190,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
190
190
|
|
191
191
|
describe "with natural keys" do
|
192
192
|
before :all do
|
193
|
-
class Author
|
193
|
+
class ::Author
|
194
194
|
include DataMapper::Resource
|
195
195
|
|
196
196
|
def self.default_repository_name; ADAPTER end
|
@@ -200,7 +200,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
200
200
|
has n, :books, :through => Resource
|
201
201
|
end
|
202
202
|
|
203
|
-
class Book
|
203
|
+
class ::Book
|
204
204
|
has n, :authors, :through => Resource
|
205
205
|
end
|
206
206
|
end
|
@@ -237,7 +237,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
237
237
|
|
238
238
|
describe "When join model has non-serial (integer) natural keys." do
|
239
239
|
before :all do
|
240
|
-
class Tag
|
240
|
+
class ::Tag
|
241
241
|
include DataMapper::Resource
|
242
242
|
|
243
243
|
def self.default_repository_name; ADAPTER end
|
@@ -249,7 +249,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
249
249
|
has n, :books, :through => :book_taggings
|
250
250
|
end
|
251
251
|
|
252
|
-
class BookTagging
|
252
|
+
class ::BookTagging
|
253
253
|
include DataMapper::Resource
|
254
254
|
|
255
255
|
def self.default_repository_name; ADAPTER end
|
@@ -261,7 +261,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
261
261
|
belongs_to :tag
|
262
262
|
end
|
263
263
|
|
264
|
-
class Book
|
264
|
+
class ::Book
|
265
265
|
has n, :book_taggings
|
266
266
|
has n, :tags, :through => :book_taggings
|
267
267
|
end
|
@@ -296,7 +296,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
296
296
|
|
297
297
|
describe "with renamed associations" do
|
298
298
|
before :all do
|
299
|
-
class Singer
|
299
|
+
class ::Singer
|
300
300
|
include DataMapper::Resource
|
301
301
|
|
302
302
|
def self.default_repository_name; ADAPTER end
|
@@ -307,7 +307,7 @@ describe DataMapper::Associations::ManyToMany::Proxy do
|
|
307
307
|
has n, :tunes, :through => Resource, :class_name => 'Song'
|
308
308
|
end
|
309
309
|
|
310
|
-
class Song
|
310
|
+
class ::Song
|
311
311
|
include DataMapper::Resource
|
312
312
|
|
313
313
|
def self.default_repository_name; ADAPTER end
|
@@ -58,7 +58,7 @@ if ADAPTER
|
|
58
58
|
step_child = ManyToOneSpec::StepChild.first(:id => @step_child.id)
|
59
59
|
logger do |log|
|
60
60
|
# should retrieve from the IdentityMap
|
61
|
-
child.parent.
|
61
|
+
child.parent.should equal(parent)
|
62
62
|
|
63
63
|
# should retrieve from the datasource
|
64
64
|
other = step_child.parent
|
@@ -2,7 +2,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_hel
|
|
2
2
|
require 'pp'
|
3
3
|
describe "OneToMany" do
|
4
4
|
before(:all) do
|
5
|
-
class Team
|
5
|
+
class ::Team
|
6
6
|
include DataMapper::Resource
|
7
7
|
|
8
8
|
def self.default_repository_name; ADAPTER end
|
@@ -14,10 +14,10 @@ describe "OneToMany" do
|
|
14
14
|
has n, :players
|
15
15
|
end
|
16
16
|
|
17
|
-
class BaseballTeam < Team
|
17
|
+
class ::BaseballTeam < Team
|
18
18
|
end
|
19
19
|
|
20
|
-
class Player
|
20
|
+
class ::Player
|
21
21
|
include DataMapper::Resource
|
22
22
|
|
23
23
|
def self.default_repository_name; ADAPTER end
|
@@ -561,7 +561,7 @@ if ADAPTER
|
|
561
561
|
end
|
562
562
|
|
563
563
|
it "should find a resource in a collection by typecasting the key" do
|
564
|
-
resource = @collection.get(
|
564
|
+
resource = @collection.get(*@nancy.key)
|
565
565
|
resource.should be_kind_of(DataMapper::Resource)
|
566
566
|
resource.id.should == @nancy.id
|
567
567
|
end
|
@@ -569,7 +569,7 @@ if ADAPTER
|
|
569
569
|
it 'should not find a resource not in the collection' do
|
570
570
|
@query.update(:offset => 0, :limit => 3)
|
571
571
|
@david = Zebra.create(:name => 'David', :age => 15, :notes => 'Albino')
|
572
|
-
@collection.get(
|
572
|
+
@collection.get(*@david.key).should be_nil
|
573
573
|
end
|
574
574
|
end
|
575
575
|
|
@@ -8,7 +8,7 @@ if HAS_POSTGRES
|
|
8
8
|
|
9
9
|
describe "auto migrating" do
|
10
10
|
before :all do
|
11
|
-
class Sputnik
|
11
|
+
class ::Sputnik
|
12
12
|
include DataMapper::Resource
|
13
13
|
|
14
14
|
property :id, Serial
|
@@ -32,7 +32,7 @@ if HAS_POSTGRES
|
|
32
32
|
describe '#312' do
|
33
33
|
it "should behave sanely for time fields" do
|
34
34
|
|
35
|
-
class Thing
|
35
|
+
class ::Thing
|
36
36
|
include DataMapper::Resource
|
37
37
|
property :id, Integer, :serial => true
|
38
38
|
property :created_at, Time
|
@@ -57,7 +57,7 @@ if HAS_POSTGRES
|
|
57
57
|
|
58
58
|
describe "querying metadata" do
|
59
59
|
before :all do
|
60
|
-
class Sputnik
|
60
|
+
class ::Sputnik
|
61
61
|
include DataMapper::Resource
|
62
62
|
|
63
63
|
property :id, Serial
|
@@ -86,7 +86,7 @@ if HAS_POSTGRES
|
|
86
86
|
|
87
87
|
describe "handling transactions" do
|
88
88
|
before :all do
|
89
|
-
class Sputnik
|
89
|
+
class ::Sputnik
|
90
90
|
include DataMapper::Resource
|
91
91
|
|
92
92
|
property :id, Serial
|
@@ -118,14 +118,14 @@ if HAS_POSTGRES
|
|
118
118
|
|
119
119
|
describe "reading & writing a database" do
|
120
120
|
before :all do
|
121
|
-
class User
|
121
|
+
class ::User
|
122
122
|
include DataMapper::Resource
|
123
123
|
|
124
124
|
property :id, Serial
|
125
125
|
property :name, DM::Text
|
126
126
|
end
|
127
127
|
|
128
|
-
class Voyager
|
128
|
+
class ::Voyager
|
129
129
|
include DataMapper::Resource
|
130
130
|
storage_names[:postgres] = 'voyagers'
|
131
131
|
|
@@ -163,7 +163,7 @@ if HAS_POSTGRES
|
|
163
163
|
result.should be_kind_of(Array)
|
164
164
|
row = result.first
|
165
165
|
row.should be_kind_of(Struct)
|
166
|
-
row.members.should == %w{id name}
|
166
|
+
row.members.map { |m| m.to_s }.should == %w{id name}
|
167
167
|
|
168
168
|
row.id.should == 1
|
169
169
|
row.name.should == 'Paul'
|
@@ -182,7 +182,7 @@ if HAS_POSTGRES
|
|
182
182
|
|
183
183
|
describe "CRUD for serial Key" do
|
184
184
|
before :all do
|
185
|
-
class VideoGame
|
185
|
+
class ::VideoGame
|
186
186
|
include DataMapper::Resource
|
187
187
|
|
188
188
|
property :id, Serial
|
@@ -282,7 +282,7 @@ if HAS_POSTGRES
|
|
282
282
|
|
283
283
|
describe "CRUD for Composite Key" do
|
284
284
|
before :all do
|
285
|
-
class BankCustomer
|
285
|
+
class ::BankCustomer
|
286
286
|
include DataMapper::Resource
|
287
287
|
|
288
288
|
property :bank, String, :key => true
|
@@ -376,7 +376,7 @@ if HAS_POSTGRES
|
|
376
376
|
|
377
377
|
describe "Ordering a Query" do
|
378
378
|
before :all do
|
379
|
-
class SailBoat
|
379
|
+
class ::SailBoat
|
380
380
|
include DataMapper::Resource
|
381
381
|
property :id, Serial
|
382
382
|
property :name, String
|
@@ -423,7 +423,7 @@ if HAS_POSTGRES
|
|
423
423
|
|
424
424
|
describe "Lazy Loaded Properties" do
|
425
425
|
before :all do
|
426
|
-
class SailBoat
|
426
|
+
class ::SailBoat
|
427
427
|
include DataMapper::Resource
|
428
428
|
property :id, Serial
|
429
429
|
property :notes, String, :lazy => [:notes]
|
@@ -467,7 +467,7 @@ if HAS_POSTGRES
|
|
467
467
|
|
468
468
|
describe "finders" do
|
469
469
|
before :all do
|
470
|
-
class SerialFinderSpec
|
470
|
+
class ::SerialFinderSpec
|
471
471
|
include DataMapper::Resource
|
472
472
|
|
473
473
|
property :id, Serial
|
@@ -528,7 +528,7 @@ if HAS_POSTGRES
|
|
528
528
|
|
529
529
|
describe "belongs_to associations" do
|
530
530
|
before :all do
|
531
|
-
class Engine
|
531
|
+
class ::Engine
|
532
532
|
include DataMapper::Resource
|
533
533
|
def self.default_repository_name; :postgres end
|
534
534
|
|
@@ -536,7 +536,7 @@ if HAS_POSTGRES
|
|
536
536
|
property :name, String
|
537
537
|
end
|
538
538
|
|
539
|
-
class Yard
|
539
|
+
class ::Yard
|
540
540
|
include DataMapper::Resource
|
541
541
|
def self.default_repository_name; :postgres end
|
542
542
|
|
@@ -617,7 +617,7 @@ if HAS_POSTGRES
|
|
617
617
|
|
618
618
|
describe "has n associations" do
|
619
619
|
before :all do
|
620
|
-
class Host
|
620
|
+
class ::Host
|
621
621
|
include DataMapper::Resource
|
622
622
|
def self.default_repository_name; :postgres end
|
623
623
|
|
@@ -627,7 +627,7 @@ if HAS_POSTGRES
|
|
627
627
|
has n, :slices
|
628
628
|
end
|
629
629
|
|
630
|
-
class Slice
|
630
|
+
class ::Slice
|
631
631
|
include DataMapper::Resource
|
632
632
|
def self.default_repository_name; :postgres end
|
633
633
|
|