diff options
author | Go MAEDA <maeda@farend.jp> | 2019-08-26 07:16:55 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-08-26 07:16:55 +0000 |
commit | 26774d09e9d0422aea19abb51ae9ffea52381fb7 (patch) | |
tree | 48432fbfc262f951433ab9910c25c47a6b6e9a51 | |
parent | 47dd2083f7958ff05deea3c56c1c2067fef64f9c (diff) | |
download | redmine-26774d09e9d0422aea19abb51ae9ffea52381fb7.tar.gz redmine-26774d09e9d0422aea19abb51ae9ffea52381fb7.zip |
Code cleanup: RuboCop: Fix Style/UnneededCondition in app/models/setting.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@18397 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | .rubocop_todo.yml | 1 | ||||
-rw-r--r-- | app/models/setting.rb | 5 |
2 files changed, 2 insertions, 4 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a3abba02..3a9db8a87 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1830,7 +1830,6 @@ Style/UnneededCondition: - 'app/controllers/messages_controller.rb' - 'app/controllers/previews_controller.rb' - 'app/models/issue.rb' - - 'app/models/setting.rb' # Cop supports --auto-correct. Style/UnneededInterpolation: diff --git a/app/models/setting.rb b/app/models/setting.rb index 9eaaaec33..b5c8ca2e5 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -107,13 +107,12 @@ class Setting < ActiveRecord::Base # Returns the value of the setting named name def self.[](name) - v = @cached_settings[name] - v ? v : (@cached_settings[name] = find_or_default(name).value) + @cached_settings[name] ||= find_or_default(name).value end def self.[]=(name, v) setting = find_or_default(name) - setting.value = (v ? v : "") + setting.value = v || '' @cached_settings[name] = nil setting.save setting.value |