lib/daengine/teamsite_metadata_parser.rb in daengine-0.5.13 vs lib/daengine/teamsite_metadata_parser.rb in daengine-0.6

- old
+ new

@@ -51,11 +51,11 @@ valid = true while (line = file.gets) case line when /<\/?data-tuple>/ if (asset.blank?) - asset = DigitalAsset.new + asset = TeamsiteDigitalAssetShim.new elsif (valid) assets[asset.guid] ||= asset.attributes # first tuple metadata wins assets[asset.guid]['documents_attributes'] ||= [] assets[asset.guid]['documents_attributes'] << docpath # assets[asset.guid]['_id'] = asset.guid @@ -90,18 +90,19 @@ delete_count += 1 elsif (assets[key]['expires_at'].nil? || (assets[key]['expires_at'] < 1.minute.from_now)) DigitalAsset.where(guid: key).try :delete_all delete_count += 1 else - da = DigitalAsset.find_or_initialize_by(guid: key) + da = TeamsiteDigitalAssetShim.find_or_initialize_by(guid: key) asset_docs = trim_package(assets[key]['documents_attributes'], last_read, da) if (!asset_docs.empty?) assets[key]['documents_attributes'] = asset_docs assets[key]['orderable'] = da.orderable unless da.new? creating = da.new? da.documents = [] begin +p "&&&&&&& calling update_attributes! #{assets[key]} da = #{da.class} #{da.inspect}" da.update_attributes!(assets[key]) rescue Exception => e error_files << "#{e} ---- #{da.try(:guid)}, #{da.try(:errors).try(:full_messages)}" end creating ? added_count += 1 : update_count += 1 \ No newline at end of file