samvera-labs / dog_biscuits

Models, vocabularies and behaviours for Hyrax applications.
Other
11 stars 4 forks source link

Check for valid uri in In `DogBiscuits::Importers::Authority` #create_record #122

Open ghost opened 5 years ago

ghost commented 5 years ago

In DogBiscuits::Importers::Authority:

def create_record(label, uri = nil)
        uri = construct_uri(label) if uri.blank?
        # TODO: check valid URI
        Qa::LocalAuthorityEntry.create(local_authority: @authority,
                                       label: cleanup_label(label),
                                       uri: uri)
      rescue ActiveRecord::RecordNotUnique
        Rails.logger.warn("Duplicate record: #{label}")
      end