Sha256: ed1131448fae11b79e20d0d99197ab363dfebec913108644ed59701677531a40
Contents?: true
Size: 738 Bytes
Versions: 12
Compression:
Stored size: 738 Bytes
Contents
def codename super&.to_sym end event :validate_codename, :validate, on: :update, changed: :codename do validate_codename_permission validate_codename_uniqueness end event :reset_codename_cache, :integrate, changed: :codename do return if action == :create && codename.nil? Card::Codename.reset_cache Card::Codename.generate_id_constants end private def validate_codename_permission return if Auth.always_ok? || Auth.as_id == creator_id errors.add :codename, t(:core_only_admins_codename) end def validate_codename_uniqueness return (self.codename = nil) if codename.blank? return if errors.present? || !Card.find_by_codename(codename) errors.add :codename, t(:core_error_code_in_use, codename: codename) end
Version data entries
12 entries across 12 versions & 1 rubygems