Sha256: 0ef7b59e239a0c3a3ca3064d2db5fe2f3147420ccb3857a26f36cde15abf3ec2
Contents?: true
Size: 443 Bytes
Versions: 1
Compression:
Stored size: 443 Bytes
Contents
module Attorney class Document < ApplicationRecord scope :published, -> { where(published: true) } validates :slug, uniqueness: true validates :slug, presence: true validate :slug_format_is_valid private def slug_format_is_valid return if slug.nil? unless slug.parameterize == slug errors.add(:slug, "Slug format is invalid, try \"#{slug.parameterize}\" instead.") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attorney-1.0.0 | app/models/attorney/document.rb |