app/models/import.rb in reso-0.1.3.1 vs app/models/import.rb in reso-0.1.4.0
- old
+ new
@@ -49,11 +49,11 @@
# Grab the XML header to avoid namespace errors later
xml_header = get_xml_header filepath, self.repeating_element
start_time = Time.now
- import_result = ImportResult.create(import: self, start_time: start_time)
+ import_result = ImportResult.create(import: self, start_time: start_time, source_data_modified: source_data_modified)
File.foreach(filepath) do |line|
stream += line
while (from_here = stream.index(open_tag)) && (to_there = stream.index(close_tag))
xml = stream[from_here..to_there + (close_tag.length-1)]
doc = Nokogiri::XML([xml_header, xml].join).remove_namespaces!
@@ -67,11 +67,14 @@
end_time: end_time,
found_listing_keys: found_listing_keys,
removed_listing_keys: removed_listing_keys.inspect
})
import_result.save
- self.update_attribute(:status, :active)
- self.update_attribute(:source_data_modified, source_data_modified)
+ self.assign_attributes({
+ status: :active,
+ source_data_modified: source_data_modified
+ })
+ self.save
File.delete(filepath)
end
end
end