simple_record 1.1.40 → 1.1.41
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.rb +2 -1
- data/test/test_simple_record.rb +20 -1
- metadata +2 -2
data/lib/simple_record.rb
CHANGED
@@ -892,6 +892,7 @@ module SimpleRecord
|
|
892
892
|
def set(name, value)
|
893
893
|
|
894
894
|
att_meta = defined_attributes_local[name.to_sym]
|
895
|
+
return if att_meta.nil?
|
895
896
|
if att_meta.type == :belongs_to
|
896
897
|
set_belongs_to(name, value)
|
897
898
|
return
|
@@ -982,7 +983,7 @@ module SimpleRecord
|
|
982
983
|
return nil if value.nil?
|
983
984
|
|
984
985
|
arg_s = arg.to_s
|
985
|
-
att_meta = defined_attributes_local[arg]
|
986
|
+
att_meta = defined_attributes_local[arg.to_sym]
|
986
987
|
if att_meta.options
|
987
988
|
if att_meta.options[:hashed]
|
988
989
|
puts 'wrapping ' + arg_s
|
data/test/test_simple_record.rb
CHANGED
@@ -430,7 +430,7 @@ class TestSimpleRecord < Test::Unit::TestCase
|
|
430
430
|
mm = MyModel.find(:first, :conditions=>["date3 >= ?", 1.minutes.ago])
|
431
431
|
puts 'mm=' + mm.inspect
|
432
432
|
assert mm
|
433
|
-
|
433
|
+
|
434
434
|
end
|
435
435
|
|
436
436
|
def test_attr_encrypted
|
@@ -472,4 +472,23 @@ class TestSimpleRecord < Test::Unit::TestCase
|
|
472
472
|
|
473
473
|
end
|
474
474
|
|
475
|
+
def test_non_persistent_attributes
|
476
|
+
mm = MyModel.new({:some_np_att=>"word"})
|
477
|
+
mm = MyModel.new({"some_other_np_att"=>"up"})
|
478
|
+
|
479
|
+
end
|
480
|
+
|
481
|
+
def test_atts_using_strings_and_symbols
|
482
|
+
mm = MyModel.new({:name=>"myname"})
|
483
|
+
mm2 = MyModel.new({"name"=>"myname"})
|
484
|
+
assert mm.name = mm2.name
|
485
|
+
|
486
|
+
mm.save
|
487
|
+
mm2.save
|
488
|
+
|
489
|
+
mm = MyModel.find(mm.id)
|
490
|
+
mm2 = MyModel.find(mm2.id)
|
491
|
+
assert mm.name = mm2.name
|
492
|
+
end
|
493
|
+
|
475
494
|
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.
|
4
|
+
version: 1.1.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-12-
|
14
|
+
date: 2009-12-30 00:00:00 -08:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|