class ValidationHelperCollection

Public Instance Methods

email() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 36
def email
  {
    allow_blank: true,
    format: {
      with: self.email_regex,
      message: 'is invalid'
    }
  }
end
email_regex() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 7
def email_regex
  /\A\s*(([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})[\s\/,;]*)+\z/
end
slug() click to toggle source

Complete Hash Validations

# File lib/fae/validation_helper_collection.rb, line 25
def slug
  {
    uniqueness: true,
    presence: true,
    format: {
      with: self.slug_regex,
      message: 'cannot have spaces or special characters'
    }
  }
end
slug_regex() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 3
def slug_regex
  /\A[-_a-zA-Z0-9]+\z/
end
url() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 46
def url
  {
    allow_blank: true,
    format: {
      with: self.url_regex,
      message: 'is invalid'
    }
  }
end
url_regex() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 11
def url_regex
  /\A(https?:\/\/)/
end
youtube_regex() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 19
def youtube_regex
  /[a-zA-Z0-9_-]{11}/
end
youtube_url() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 66
def youtube_url
  {
    allow_blank: true,
    format: {
      with: self.youtube_regex,
      message: 'is invalid'
    }
  }
end
zip() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 56
def zip
  {
    allow_blank: true,
    format: {
      with: self.zip_regex,
      message: 'is invalid'
    }
  }
end
zip_regex() click to toggle source
# File lib/fae/validation_helper_collection.rb, line 15
def zip_regex
  /\A(\d{5})?\z/
end