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



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

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