Sha256: c7d6a52d8d609331fd474d90186dcdbf7e2727eb36e584a5c8b2047f18c3d859
Contents?: true
Size: 737 Bytes
Versions: 1
Compression:
Stored size: 737 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
card-1.101.4 | mod/core/set/all/codename.rb |