Commit 757cddf5
Changed files (2)
app
services
commands
app/services/commands/migrate_primary_image.rb
@@ -0,0 +1,10 @@
+class MigratePrimaryImage < Struct.new(:creation_id)
+ def perform
+ creation = Creation.find(creation_id)
+ photo = creation.photos.build({})
+ photo.created_at = creation.created_at
+ photo.updated_at = creation.updated_at
+ photo.image = creation.image.file
+ photo.save!
+ end
+end
db/migrate/20121010190225_migrate_images_for_each_creation.rb
@@ -1,14 +1,3 @@
-class MigratePrimaryImage < Struct.new(:creation_id)
- def perform
- creation = Creation.find(creation_id)
- photo = creation.photos.build({})
- photo.created_at = creation.created_at
- photo.updated_at = creation.updated_at
- photo.image = creation.image.file
- photo.save!
- end
-end
-
class MigrateImagesForEachCreation < ActiveRecord::Migration
def up
Creation.all.each_with_index do |creation, index|