simple_record 1.1.57 → 1.1.59

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 CHANGED
@@ -88,7 +88,7 @@ module SimpleRecord
88
88
 
89
89
  # Convert attributes to sdb values
90
90
  attrs.each_pair do |name, value|
91
- set(name, value)
91
+ set(name, value, false)
92
92
  end
93
93
  end
94
94
 
@@ -529,7 +529,7 @@ module SimpleRecord
529
529
  return ret
530
530
  end
531
531
 
532
- def set(name, value)
532
+ def set(name, value, dirtify=true)
533
533
 
534
534
  att_meta = defined_attributes_local[name.to_sym]
535
535
  if att_meta.nil?
@@ -556,7 +556,7 @@ module SimpleRecord
556
556
  end
557
557
  end
558
558
  attvalue = strip_array(attvalue)
559
- make_dirty(attname, attvalue)
559
+ make_dirty(name, attvalue) if dirtify
560
560
  # puts "ARG=#{attname.to_s} setting to #{attvalue}"
561
561
  sdb_val = ruby_to_sdb(name, attvalue)
562
562
  # puts "sdb_val=" + sdb_val.to_s
@@ -44,7 +44,7 @@ module SimpleRecord
44
44
 
45
45
  # Convert value from SimpleDB String version to real ruby value.
46
46
  def sdb_to_ruby(name, value)
47
- # puts 'sdb_to_ruby arg=' + name.inspect + ' - ' + name.class.name + ' - value=' + value.to_s
47
+ puts 'sdb_to_ruby arg=' + name.inspect + ' - ' + name.class.name + ' - value=' + value.to_s
48
48
  return nil if value.nil?
49
49
  att_meta = defined_attributes_local[name.to_sym]
50
50
 
@@ -165,6 +165,19 @@ class TestSimpleRecord < TestBase
165
165
  mm2.save(:dirty=>true)
166
166
  puts SimpleRecord.stats.puts.to_s
167
167
  assert SimpleRecord.stats.puts == 0
168
+
169
+ mmc = MyChildModel.new
170
+ mmc.my_model = mm
171
+ mmc.x = mm
172
+ mmc.save
173
+
174
+ mmc.my_model = nil
175
+ mmc.x = nil
176
+
177
+ mmc = MyChildModel.find(mmc.id)
178
+ mmc.my_model = nil
179
+ mmc.x = nil
180
+
168
181
  end
169
182
 
170
183
  # http://api.rubyonrails.org/classes/ActiveRecord/Dirty.html#M002136
@@ -192,7 +205,7 @@ class TestSimpleRecord < TestBase
192
205
  assert mm.changes["name"][1] == "Jim"
193
206
 
194
207
  assert mm.name_changed?
195
- assert mm.name_was == "Travis"
208
+ assert mm.name_was == "Travis", "was #{mm.name_was}"
196
209
  assert mm.name_change[0] == "Travis"
197
210
  assert mm.name_change[1] == "Jim"
198
211
 
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.57
4
+ version: 1.1.59
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: 2010-01-04 00:00:00 -08:00
14
+ date: 2010-01-05 00:00:00 -08:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency