Browse Source

Explicitly define attached file of DeprecatedPreviewCard (#4786)

The path template of the attached files must explicitly be defined because
it is contradicting to the name of the class.
master
Akihiko Odaki 7 years ago
committed by Eugen Rochko
parent
commit
249bdc169c
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      lib/tasks/mastodon.rake

+ 9
- 2
lib/tasks/mastodon.rake View File

@ -275,8 +275,15 @@ namespace :mastodon do
task remove_deprecated_preview_cards: :environment do
return unless ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards'
class DeprecatedPreviewCard < PreviewCard
self.table_name = 'deprecated_preview_cards'
class DeprecatedPreviewCard < ActiveRecord::Base
self.inheritance_column = false
path = '/preview_cards/:attachment/:id_partition/:style/:filename'
if ENV['S3_ENABLED'] != 'true'
path = (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + path
end
has_attached_file :image, styles: { original: '280x120>' }, convert_options: { all: '-quality 80 -strip' }, path: path
end
puts 'Delete records and associated files from deprecated preview cards? [y/N]: '

Loading…
Cancel
Save