app/models/ddr/batch/batch_object_attribute.rb in ddr-batch-2.0.0.beta.3 vs app/models/ddr/batch/batch_object_attribute.rb in ddr-batch-2.0.0.beta.4
- old
+ new
@@ -26,11 +26,11 @@
obj.validates :value_type, inclusion: { in: VALUE_TYPES }
end
def valid_datastream_operation
if operation == OPERATION_CLEAR_ALL
- unless datastream == 'descMetadata'
+ unless datastream == Ddr::Models::Metadata::DESC_METADATA
errors.add(:operation, "Operation #{operation} is not valid for #{datastream}")
end
end
end
@@ -53,17 +53,17 @@
def datastream_type
batch_object.model.constantize.ds_specs[datastream][:type] rescue nil
end
def datastream_valid?
- [ 'adminMetadata', 'descMetadata' ].include?(datastream)
+ [ Ddr::Models::Metadata::ADMIN_METADATA, Ddr::Models::Metadata::DESC_METADATA ].include?(datastream)
end
def attribute_name_valid?
case datastream
- when 'adminMetadata'
+ when Ddr::Models::Metadata::ADMIN_METADATA
batch_object.model.constantize.properties.include?(name)
- when 'descMetadata'
+ when Ddr::Models::Metadata::DESC_METADATA
Ddr::Models::DescriptiveMetadata.unqualified_names.include?(name.to_sym)
end
end
end