Sha256: 5acf8b48cade9ffeeda7fdc974a960b0a0cfc874df51e86daeeaac33d49d8abf
Contents?: true
Size: 381 Bytes
Versions: 20
Compression:
Stored size: 381 Bytes
Contents
# frozen_string_literal: true class PostType < ApplicationRecord validates :name, uniqueness: true validates :name, presence: true validate :name_is_not_read before_save :sanitize_title def name_is_not_read errors.add(:name, I18n.t("errors.article_type_already_exist")) if name == "read" end def sanitize_title self.permalink = name.to_permalink end end
Version data entries
20 entries across 20 versions & 2 rubygems