Sha256: d2f1593575f296e7d8924d4635363458c2dd74d5826a4239593aa5081fe28270

Contents?: true

Size: 245 Bytes

Versions: 59

Compression:

Stored size: 245 Bytes

Contents

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

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
curation_concerns-1.7.8 app/validators/has_one_title_validator.rb
curation_concerns-1.7.7 app/validators/has_one_title_validator.rb
curation_concerns-2.0.0 app/validators/has_one_title_validator.rb
curation_concerns-2.0.0.rc2 app/validators/has_one_title_validator.rb
curation_concerns-1.7.6 app/validators/has_one_title_validator.rb
curation_concerns-1.7.5 app/validators/has_one_title_validator.rb
curation_concerns-1.7.4 app/validators/has_one_title_validator.rb
curation_concerns-1.7.3 app/validators/has_one_title_validator.rb
curation_concerns-1.7.2 app/validators/has_one_title_validator.rb
curation_concerns-2.0.0.rc1 app/validators/has_one_title_validator.rb
curation_concerns-1.7.1 app/validators/has_one_title_validator.rb
curation_concerns-1.7.0 app/validators/has_one_title_validator.rb
curation_concerns-1.7.0.beta1 app/validators/has_one_title_validator.rb
curation_concerns-1.6.3 app/validators/has_one_title_validator.rb
curation_concerns-1.6.2 app/validators/has_one_title_validator.rb
curation_concerns-1.6.1 app/validators/has_one_title_validator.rb
curation_concerns-1.6.0 app/validators/has_one_title_validator.rb
curation_concerns-1.5.0 app/validators/has_one_title_validator.rb
curation_concerns-1.4.0 app/validators/has_one_title_validator.rb
curation_concerns-1.3.3 app/validators/has_one_title_validator.rb