Sha256: 87c6c4ee7ca9a85b4a8e542127b51b6f50fc58b5a18320809b3486b384ec50e2

Contents?: true

Size: 307 Bytes

Versions: 25

Compression:

Stored size: 307 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  # validates that the title has at least one title
  class HasOneTitleValidator < ActiveModel::Validator
    def validate(record)
      return unless record.title.reject(&:empty?).empty?
      record.errors[:title] << "You must provide a title"
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/validators/hyrax/has_one_title_validator.rb
hyrax-5.0.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-5.0.0.rc3 app/validators/hyrax/has_one_title_validator.rb
hyrax-5.0.0.rc2 app/validators/hyrax/has_one_title_validator.rb
hyrax-5.0.0.rc1 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.6.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-4.0.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-4.0.0.rc3 app/validators/hyrax/has_one_title_validator.rb
hyrax-4.0.0.rc2 app/validators/hyrax/has_one_title_validator.rb
hyrax-4.0.0.rc1 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.5.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-4.0.0.beta2 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.4.2 app/validators/hyrax/has_one_title_validator.rb
hyrax-4.0.0.beta1 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.4.1 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.4.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.3.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.2.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.1.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.0.2 app/validators/hyrax/has_one_title_validator.rb