EasyRecon/Hunt3r

View on GitHub
backend/app/models/mesh.rb

Summary

Maintainability
A
0 mins
Test Coverage
class Mesh < ApplicationRecord
  validates :url, presence: true, uniqueness: { case_sensitive: false, message: I18n.t('errors.models.mesh.uniqueness') }
  validates :token, format: { with: /\A(?=.*).{15,100}\z/, message: I18n.t('errors.models.mesh.format_token') }, unless: :token?

  before_save { url.downcase! }

  private

  def token?
    token.nil?
  end
end