Class: Hyrax::HasOneTitleValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/validators/hyrax/has_one_title_validator.rb

Overview

validates that the title has at least one title

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object


4
5
6
7
# File 'app/validators/hyrax/has_one_title_validator.rb', line 4

def validate(record)
  return unless record.title.reject(&:empty?).empty?
  record.errors[:title] << "You must provide a title"
end