lib/graphdb/model/extensions/open_assets/tx_out.rb in bitcoin2graphdb-0.3.3 vs lib/graphdb/model/extensions/open_assets/tx_out.rb in bitcoin2graphdb-0.3.4
- old
+ new
@@ -10,21 +10,21 @@
end
base.class_eval do
property :asset_quantity, type: Integer
property :oa_output_type
- has_one :out, :asset_id, type: :asset_id, model_class: AssetId
+ has_one :out, :asset_id, type: :asset_id, model_class: 'Graphdb::Model::AssetId'
end
end
module ClassMethods
end
def apply_oa_attributes(oa_out)
self.asset_quantity = oa_out['asset_quantity']
self.oa_output_type = oa_out['output_type']
- self.asset_id = AssetId.find_or_create(oa_out['asset_id']) unless oa_out['asset_id'].nil?
+ self.asset_id = oa_out['asset_id'].nil? ? nil : AssetId.find_or_create(oa_out['asset_id'])
self.oa_output_type = 'uncolored' if self.asset_id.nil? && self.oa_output_type != 'marker'
save!
end
end
\ No newline at end of file