diff --git a/db/migrate/20110706171330_fix_misunderstood_script_filename.rb b/db/migrate/20110706171330_fix_misunderstood_script_filename.rb index cb197a2..aae4a3e 100644 --- a/db/migrate/20110706171330_fix_misunderstood_script_filename.rb +++ b/db/migrate/20110706171330_fix_misunderstood_script_filename.rb @@ -36,12 +36,18 @@ class FixMisunderstoodScriptFilename < ActiveRecord::Migration image.create_thumbnails end - UploadedFile.all.select { |u| u.content_type != 'text/plain' && File.extname(u.filename) == '.txt' }.map do |uploaded_file| + UploadedFile.all.select { |u| u.image? && File.extname(u.filename) == '.txt' }.map do |uploaded_file| uploaded_file.thumbnails.destroy_all uploaded_file.filename = fixed_name(uploaded_file) uploaded_file.save! uploaded_file.create_thumbnails end + + Thumbnail.all.select { |u| u.image? && File.extname(u.filename) == '.txt' }.map do |thumbnail| + thumbnail.filename = fixed_name(thumbnail) + thumbnail.save! + end + end def self.down diff --git a/db/schema.rb b/db/schema.rb index 0deb708..e3b360f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110527042608) do +ActiveRecord::Schema.define(:version => 20110706171330) do create_table "action_tracker", :force => true do |t| t.integer "user_id" -- libgit2 0.21.2