lib/render/schema.rb in render-0.0.3 vs lib/render/schema.rb in render-0.0.4

- old
+ new

@@ -47,18 +47,19 @@ self.serialized_data = array_attribute.serialize(explicit_data) else self.serialized_data = hash_attributes.inject({}) do |processed_explicit_data, attribute| explicit_data ||= {} value = explicit_data.fetch(attribute.name, nil) - serialized_attribute = attribute.serialize(value) + maintain_nil = explicit_data.has_key?(attribute.name) + + serialized_attribute = attribute.serialize(value, maintain_nil) processed_explicit_data.merge!(serialized_attribute) end end end - def render!(options_and_explicit_data = nil) - endpoint = options_and_explicit_data.delete(:endpoint) if options_and_explicit_data.is_a?(Hash) - self.raw_data = Render.live ? request(endpoint) : options_and_explicit_data + def render!(explicit_data = nil, endpoint = nil) + self.raw_data = Render.live ? request(endpoint) : explicit_data serialize!(raw_data) yield serialized_data if block_given? self.rendered_data = DottableHash.new(hash_with_title_prefixes(serialized_data)) end