diff --git a/app/models/photo.rb b/app/models/photo.rb index 9564f3960..dd9700ad5 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -33,12 +33,16 @@ class Photo < Post photo = super(params) image_file = params.delete(:user_file) photo.random_string = gen_random_string(10) - + photo.processed = false photo.image.store! image_file photo.update_photo_remote_path photo end + def not_processed? + !self.processed + end + def update_photo_remote_path unless self.image.url.match(/^https?:\/\//) pod_url = AppConfig[:pod_url].dup @@ -66,7 +70,7 @@ class Photo < Post end def url(name = nil) - if self.image.path.include? '.gif' + if self.not_processed? || self.image.path.include? '.gif' image.url elsif remote_photo_path name = name.to_s + '_' if name diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb index 03a71948a..827120ae6 100644 --- a/app/uploaders/image_uploader.rb +++ b/app/uploaders/image_uploader.rb @@ -39,6 +39,7 @@ class ImageUploader < CarrierWave::Uploader::Base end self.recreate_versions! + self.model.processed = true self.model.update_photo_remote_path self.model.save else diff --git a/db/migrate/20110319005509_add_processed_to_post.rb b/db/migrate/20110319005509_add_processed_to_post.rb new file mode 100644 index 000000000..2d63adb38 --- /dev/null +++ b/db/migrate/20110319005509_add_processed_to_post.rb @@ -0,0 +1,9 @@ +class AddProcessedToPost < ActiveRecord::Migration + def self.up + add_column(:posts, :processed, :boolean, :default => true) + end + + def self.down + remove_column(:posts, :processed) + end +end diff --git a/db/schema.rb b/db/schema.rb index 6f99d15a0..a55b15a5c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20110318012008) do +ActiveRecord::Schema.define(:version => 20110319005509) do create_table "aspect_memberships", :force => true do |t| t.integer "aspect_id", :null => false @@ -210,6 +210,7 @@ ActiveRecord::Schema.define(:version => 20110318012008) do t.datetime "created_at" t.datetime "updated_at" t.string "mongo_id" + t.boolean "processed", :default => true end add_index "posts", ["author_id"], :name => "index_posts_on_person_id"