simple_record 1.1.54 → 1.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/simple_record/attributes.rb +1 -1
- data/test/my_child_model.rb +1 -0
- data/test/test_simple_record.rb +15 -1
- metadata +1 -1
@@ -147,7 +147,7 @@ module SimpleRecord
|
|
147
147
|
arg_id_val = send("#{arg_id}")
|
148
148
|
if arg_id_val
|
149
149
|
if !cache_store.nil?
|
150
|
-
arg_id_val = @attributes[arg_id][0]
|
150
|
+
# arg_id_val = @attributes[arg_id][0]
|
151
151
|
cache_key = self.class.cache_key(class_name, arg_id_val)
|
152
152
|
# puts 'cache_key=' + cache_key
|
153
153
|
ret = cache_store.read(cache_key)
|
data/test/my_child_model.rb
CHANGED
data/test/test_simple_record.rb
CHANGED
@@ -458,7 +458,7 @@ class TestSimpleRecord < TestBase
|
|
458
458
|
assert mm.name = mm2.name
|
459
459
|
end
|
460
460
|
|
461
|
-
|
461
|
+
def test_constructor_using_belongs_to_ids
|
462
462
|
mm = MyModel.new({:name=>"myname"})
|
463
463
|
mm.save
|
464
464
|
|
@@ -482,4 +482,18 @@ class TestSimpleRecord < TestBase
|
|
482
482
|
assert mm.date2 == now
|
483
483
|
end
|
484
484
|
|
485
|
+
def test_explicit_class_name
|
486
|
+
mm = MyModel.new({:name=>"myname"})
|
487
|
+
mm.save
|
488
|
+
|
489
|
+
mm2 = MyChildModel.new({"name"=>"myname2"})
|
490
|
+
mm2.x = mm
|
491
|
+
assert mm2.x.id == mm.id
|
492
|
+
mm2.save
|
493
|
+
|
494
|
+
mm3 = MyChildModel.find(mm2.id)
|
495
|
+
puts "mm3.x=" + mm3.x.inspect
|
496
|
+
assert mm3.x.id == mm.id
|
497
|
+
end
|
498
|
+
|
485
499
|
end
|