Skip to content

Commit

Permalink
replace not nil check on nil value
Browse files Browse the repository at this point in the history
replace not nil check on nil value

replace not nil check on nil value
  • Loading branch information
ferrisoxide committed Dec 5, 2023
1 parent 7c13e93 commit 2539d20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def [](name)
return cache[name] if cache.key?(name)

# Check database
if database_and_table_exists? && setting = find_by_name(name.to_s) && !setting.value.nil?
if database_and_table_exists? && (setting = find_by_name(name.to_s))&.value.present?
return cache[name] = setting.value
end
end
# Check YAML settings
return cache[name] = yaml_settings[name] if yaml_settings.key?(name)
end
Expand Down

0 comments on commit 2539d20

Please sign in to comment.