simple_record 1.1.49 → 1.1.51

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.
@@ -540,10 +540,12 @@ module SimpleRecord
540
540
  end
541
541
  attvalue = strip_array(attvalue)
542
542
  make_dirty(attname, attvalue)
543
- # puts 'ARG=' + arg.to_s
543
+ puts "ARG=#{attname.to_s} setting to #{attvalue}"
544
544
  sdb_val = ruby_to_sdb(name, attvalue)
545
+ puts "sdb_val=" + sdb_val.to_s
545
546
  @attributes[attname] = sdb_val
546
- attvalue = wrap_if_required(name, value, sdb_val)
547
+ attvalue = wrap_if_required(name, attvalue, sdb_val)
548
+ puts 'attvalue2=' + attvalue.to_s
547
549
  @attributes_rb[attname] = attvalue
548
550
 
549
551
  # instance_var = "@" + attname.to_s
@@ -180,8 +180,16 @@ module SimpleRecord
180
180
 
181
181
  # Define ID reader method for reading the associated objects id without getting the entire object
182
182
  send(:define_method, arg_id) do
183
- if !@attributes[arg_id].nil? && @attributes[arg_id].size > 0 && @attributes[arg_id][0] != nil && @attributes[arg_id][0] != ''
184
- return @attributes[arg_id][0]
183
+ val1 = @attributes[arg_id]
184
+ if val1
185
+ if val1.is_a?(Array)
186
+ if val1.size > 0 && val1[0].present?
187
+ return val1[0]
188
+ end
189
+
190
+ else
191
+ return val1
192
+ end
185
193
  end
186
194
  return nil
187
195
  end
@@ -224,7 +232,6 @@ module SimpleRecord
224
232
  end
225
233
 
226
234
 
227
-
228
235
  def self.handle_virtuals(attrs)
229
236
  @@virtuals.each do |virtual|
230
237
  #we first copy the information for the virtual to an instance variable of the same name
@@ -102,7 +102,6 @@ module SimpleRecord
102
102
  def wrap_if_required(arg, value, sdb_val)
103
103
  return nil if value.nil?
104
104
 
105
- arg_s = arg.to_s
106
105
  att_meta = defined_attributes_local[arg.to_sym]
107
106
  if att_meta && att_meta.options
108
107
  if att_meta.options[:hashed]
@@ -99,7 +99,11 @@ class TestSimpleRecord < TestBase
99
99
  child = MyChildModel.new
100
100
  child.name = "Child"
101
101
  child.my_model = mm
102
+ puts 'c1=' + child.inspect
103
+ puts 'mmid1=' + child.my_model_id.to_s
104
+ assert child.my_model_id == mm.id
102
105
  child.save
106
+ puts 'mmid2=' + child.my_model_id.to_s
103
107
 
104
108
  puts "child=" + child.inspect
105
109
  sleep 1
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.49
4
+ version: 1.1.51
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder