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-3.0.1 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.0.0 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.0.0.pre.rc4 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.0.0.pre.rc3 app/validators/hyrax/has_one_title_validator.rb
hyrax-3.0.0.pre.rc2 app/validators/hyrax/has_one_title_validator.rb