I am not sure exactly what is happening but I know that the dob field is being trashed on update.
From what I can tell the fetch is returning the object with the date being broken out into parts. I passed "1974-04-05" as the dob input to both calls. To see what was going on I added some logging to the initialize and save methods. Here is the output from the two calls. Both calls included the same data.
I will keep digging and see if I can find the spot where the dob on update is being initialized with what appears to be an array with the dob and the ssn.
I wrapped the initialize call to see what was happening.
def initialize(attributes = {})
Rails.logger.debug("Raw Attributes: #{attributes.inspect}")
@attributes = Utils.indifferent_read_access attributes
Rails.logger.debug("Read Attributes: #{@attributes.inspect}")
@hyperlinks = {}
end
...
def save
href = @attributes.delete('href')
method = :post
if href.nil?
href = self.class.collection_path
elsif !Balanced.is_collection(href)
method = :put
end
attributes_to_submit = self.sanitize
Rails.logger.debug("Submitting: #{attributes_to_submit.inspect}")
begin
@response = Balanced.send(method, href, attributes_to_submit)
rescue Balanced::Error
# restore the href on the instance if there was an exception
# this will allow us to try to fix any attributes and save again
@attributes['href'] = href
raise
end
reload @response
end
I am not sure exactly what is happening but I know that the dob field is being trashed on update.
From what I can tell the fetch is returning the object with the date being broken out into parts. I passed "1974-04-05" as the dob input to both calls. To see what was going on I added some logging to the initialize and save methods. Here is the output from the two calls. Both calls included the same data.
I will keep digging and see if I can find the spot where the dob on update is being initialized with what appears to be an array with the dob and the ssn.
I wrapped the initialize call to see what was happening.
Create Method:
Create Method output:
Update Method:
Update Call Output: