Commit 4ef1070c53697b9512732c996c2c35ffe7cfdca7
1 parent
9173ce0f
Exists in
master
and in
29 other branches
Added Thumbnail on migration
Also included new db/schema.rb (ActionItem2032)
Showing
2 changed files
with
8 additions
and
2 deletions
Show diff stats
db/migrate/20110706171330_fix_misunderstood_script_filename.rb
@@ -36,12 +36,18 @@ class FixMisunderstoodScriptFilename < ActiveRecord::Migration | @@ -36,12 +36,18 @@ class FixMisunderstoodScriptFilename < ActiveRecord::Migration | ||
36 | image.create_thumbnails | 36 | image.create_thumbnails |
37 | end | 37 | end |
38 | 38 | ||
39 | - UploadedFile.all.select { |u| u.content_type != 'text/plain' && File.extname(u.filename) == '.txt' }.map do |uploaded_file| | 39 | + UploadedFile.all.select { |u| u.image? && File.extname(u.filename) == '.txt' }.map do |uploaded_file| |
40 | uploaded_file.thumbnails.destroy_all | 40 | uploaded_file.thumbnails.destroy_all |
41 | uploaded_file.filename = fixed_name(uploaded_file) | 41 | uploaded_file.filename = fixed_name(uploaded_file) |
42 | uploaded_file.save! | 42 | uploaded_file.save! |
43 | uploaded_file.create_thumbnails | 43 | uploaded_file.create_thumbnails |
44 | end | 44 | end |
45 | + | ||
46 | + Thumbnail.all.select { |u| u.image? && File.extname(u.filename) == '.txt' }.map do |thumbnail| | ||
47 | + thumbnail.filename = fixed_name(thumbnail) | ||
48 | + thumbnail.save! | ||
49 | + end | ||
50 | + | ||
45 | end | 51 | end |
46 | 52 | ||
47 | def self.down | 53 | def self.down |
db/schema.rb
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | # | 9 | # |
10 | # It's strongly recommended to check this file into your version control system. | 10 | # It's strongly recommended to check this file into your version control system. |
11 | 11 | ||
12 | -ActiveRecord::Schema.define(:version => 20110527042608) do | 12 | +ActiveRecord::Schema.define(:version => 20110706171330) do |
13 | 13 | ||
14 | create_table "action_tracker", :force => true do |t| | 14 | create_table "action_tracker", :force => true do |t| |
15 | t.integer "user_id" | 15 | t.integer "user_id" |