This rule was added in rubocop-rails 2.25.0. Applying it allows us to simplify the code a little bit. For example, now there's no need to specify the `proposals` table in proposal scopes, which was actually causing a bug in the `Legislation::Proposal` model, which was using the `proposals` table instead of the `legislation_proposals` table (but, since we don't use this scope, it didn't affect the application).
9 lines
285 B
Ruby
9 lines
285 B
Ruby
namespace :files do
|
|
desc "Removes cached attachments which weren't deleted for some reason"
|
|
task remove_old_cached_attachments: :environment do
|
|
Tenant.run_on_each do
|
|
ActiveStorage::Blob.unattached.where(created_at: ..1.day.ago).find_each(&:purge_later)
|
|
end
|
|
end
|
|
end
|