Allow only letters and underscores in Setting code

This commit is contained in:
Karl Erik Õunapuu 2020-08-12 17:25:55 +03:00
parent c977872c44
commit abea8abe84
4 changed files with 101 additions and 2 deletions

View file

@ -4,6 +4,7 @@ class SettingEntry < ApplicationRecord
validates :format, presence: true
validates :group, presence: true
validate :valid_value_format
validates_format_of :code, with: /([a-z])[a-z|_]+[a-z]/
VALUE_FORMATS = {
string: :string_format,