summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-08-26 07:16:55 +0000
committerGo MAEDA <maeda@farend.jp>2019-08-26 07:16:55 +0000
commit26774d09e9d0422aea19abb51ae9ffea52381fb7 (patch)
tree48432fbfc262f951433ab9910c25c47a6b6e9a51
parent47dd2083f7958ff05deea3c56c1c2067fef64f9c (diff)
downloadredmine-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.yml1
-rw-r--r--app/models/setting.rb5
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