mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Refactor dynamic validation, test for it
This commit is contained in:
parent
5258c43faa
commit
b0e9828a01
3 changed files with 25 additions and 8 deletions
|
@ -3,10 +3,13 @@ class SettingGroup < ActiveRecord::Base
|
|||
|
||||
accepts_nested_attributes_for :settings
|
||||
|
||||
DOMAIN_VALIDATION_CODE = 'domain_validation'
|
||||
def setting(key)
|
||||
settings.find_by(code: key.to_s)
|
||||
end
|
||||
|
||||
def get(key)
|
||||
s = settings.find_by(code: key.to_s)
|
||||
s.try(:value)
|
||||
class << self
|
||||
def domain_validation
|
||||
find_by(code: 'domain_validation')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue