api_resource 0.6.9 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/api_resource/attributes.rb +2 -2
- data/lib/api_resource/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
@@ -191,7 +191,7 @@ module ApiResource
|
|
191
191
|
|
192
192
|
def write_attribute(name, val)
|
193
193
|
old_val = read_attribute(name)
|
194
|
-
new_val = self.typecast_attribute(name, val)
|
194
|
+
new_val = val.nil? ? nil : self.typecast_attribute(name, val)
|
195
195
|
|
196
196
|
unless old_val == new_val
|
197
197
|
self.send("#{name}_will_change!")
|
@@ -247,7 +247,7 @@ module ApiResource
|
|
247
247
|
val = self.default_value_for_field(field)
|
248
248
|
end
|
249
249
|
# now we typecast
|
250
|
-
val = self.typecast_attribute(field, val)
|
250
|
+
val = val.nil? ? nil : self.typecast_attribute(field, val)
|
251
251
|
return @attributes_cache[field.to_sym] = val
|
252
252
|
end
|
253
253
|
end
|
data/lib/api_resource/version.rb
CHANGED