mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 09:21:43 +02:00
Test boolean setting returns false for nil value
This commit is contained in:
parent
2330e8eab1
commit
75181f5bea
3 changed files with 7 additions and 9 deletions
|
@ -18,7 +18,7 @@ class SettingEntry < ApplicationRecord
|
|||
|
||||
def retrieve
|
||||
method = VALUE_FORMATS[format]
|
||||
return false if format == 'boolean' && value.blank?
|
||||
return false if self.format == 'boolean' && value.blank?
|
||||
return if value.blank?
|
||||
|
||||
send(method)
|
||||
|
@ -49,9 +49,10 @@ class SettingEntry < ApplicationRecord
|
|||
|
||||
# Hooks
|
||||
def replace_boolean_nil_with_false
|
||||
return unless format == 'boolean'
|
||||
return unless self.format == 'boolean'
|
||||
return if value == 'true'
|
||||
|
||||
self.value = value == 'true' ? 'true' : 'false'
|
||||
self.value = 'false'
|
||||
end
|
||||
|
||||
def validate_code_is_not_using_reserved_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue