simple_record 1.1.54 → 1.1.55

Sign up to get free protection for your applications and to get access to all the features.
@@ -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)
@@ -3,6 +3,7 @@ require 'my_model'
3
3
 
4
4
  class MyChildModel < SimpleRecord::Base
5
5
  belongs_to :my_model
6
+ belongs_to :x, :class_name=>"MyModel"
6
7
  has_attributes :name, :child_attr
7
8
 
8
9
  end
@@ -458,7 +458,7 @@ class TestSimpleRecord < TestBase
458
458
  assert mm.name = mm2.name
459
459
  end
460
460
 
461
- def test_constructor_using_belongs_to_ids
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.54
4
+ version: 1.1.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder