diff --git a/.rubocop.yml b/.rubocop.yml index d53c4f660..a44b298cb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -469,6 +469,9 @@ Style/MethodDefParentheses: Style/MutableConstant: Enabled: true +Style/NegatedIfElseCondition: + Enabled: true + Style/Not: Enabled: true diff --git a/app/models/document.rb b/app/models/document.rb index e6e21b526..da9bbfd08 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -50,18 +50,18 @@ class Document < ApplicationRecord end def prefix(attachment, _style) - if !attachment.instance.persisted? - "cached_attachments/user/#{attachment.instance.user_id}" - else + if attachment.instance.persisted? ":attachment/:id_partition" + else + "cached_attachments/user/#{attachment.instance.user_id}" end end def custom_hash_data(attachment) - original_filename = if !attachment.instance.persisted? - attachment.instance.attachment_file_name - else + original_filename = if attachment.instance.persisted? attachment.instance.title + else + attachment.instance.attachment_file_name end "#{attachment.instance.user_id}/#{original_filename}" end diff --git a/app/models/image.rb b/app/models/image.rb index 7bcac83f1..961307b23 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -52,10 +52,10 @@ class Image < ApplicationRecord end def prefix(attachment, _style) - if !attachment.instance.persisted? - "cached_attachments/user/#{attachment.instance.user_id}" - else + if attachment.instance.persisted? ":attachment/:id_partition" + else + "cached_attachments/user/#{attachment.instance.user_id}" end end diff --git a/app/views/budgets/results/_results_table.html.erb b/app/views/budgets/results/_results_table.html.erb index 0a2dca5e3..696ea2280 100644 --- a/app/views/budgets/results/_results_table.html.erb +++ b/app/views/budgets/results/_results_table.html.erb @@ -1,5 +1,5 @@