diff options
author | Nick Schonning <nschonni@gmail.com> | 2023-02-18 17:09:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-19 07:09:40 +0900 |
commit | 2177daeae92b77be6797ba8f2ab6ebe1e641e078 (patch) | |
tree | 2cf004cd1611bd53f21cdb8021e98aa499448627 /app/models/form | |
parent | 167709f6b0731c163619c58afcb0ca11bb393e54 (diff) |
Autofix Rubocop Style/RedundantBegin (#23703)
Diffstat (limited to 'app/models/form')
-rw-r--r-- | app/models/form/admin_settings.rb | 12 | ||||
-rw-r--r-- | app/models/form/custom_emoji_batch.rb | 12 |
2 files changed, 10 insertions, 14 deletions
diff --git a/app/models/form/admin_settings.rb b/app/models/form/admin_settings.rb index 070478e8e..95c53084a 100644 --- a/app/models/form/admin_settings.rb +++ b/app/models/form/admin_settings.rb @@ -76,13 +76,11 @@ class Form::AdminSettings define_method(key) do return instance_variable_get("@#{key}") if instance_variable_defined?("@#{key}") - stored_value = begin - if UPLOAD_KEYS.include?(key) - SiteUpload.where(var: key).first_or_initialize(var: key) - else - Setting.public_send(key) - end - end + stored_value = if UPLOAD_KEYS.include?(key) + SiteUpload.where(var: key).first_or_initialize(var: key) + else + Setting.public_send(key) + end instance_variable_set("@#{key}", stored_value) end diff --git a/app/models/form/custom_emoji_batch.rb b/app/models/form/custom_emoji_batch.rb index f4fa84c10..484415f90 100644 --- a/app/models/form/custom_emoji_batch.rb +++ b/app/models/form/custom_emoji_batch.rb @@ -36,13 +36,11 @@ class Form::CustomEmojiBatch def update! custom_emojis.each { |custom_emoji| authorize(custom_emoji, :update?) } - category = begin - if category_id.present? - CustomEmojiCategory.find(category_id) - elsif category_name.present? - CustomEmojiCategory.find_or_create_by!(name: category_name) - end - end + category = if category_id.present? + CustomEmojiCategory.find(category_id) + elsif category_name.present? + CustomEmojiCategory.find_or_create_by!(name: category_name) + end custom_emojis.each do |custom_emoji| custom_emoji.update(category_id: category&.id) |