Sha256: 6009c59a19fcfebf07937cf1044acd9191be138d78a233fb61dbadf35ce389da

Contents?: true

Size: 673 Bytes

Versions: 3

Compression:

Stored size: 673 Bytes

Contents

# This migration is deficient in that it doesn't send `each` on line 5 and so does nothing,
# but since it has already been run we have to keep it around.
class MigrateExistingDate < ActiveRecord::Migration
  def up
    %w(Image::Response Question::Answer Text::Response URL::Response).each do |class_name|
      "Tasks::Taskables::#{class_name}".constantize.send(:all) do |model|
        if model.request.task.present?
          Tasks::Taskables::Taskable::Response.create do |response|
            response.author = model.author
            response.submittable = model
            response.task = model.request.task
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tasuku-1.1.0 db/migrate/20140606072225_migrate_existing_date.rb
tasuku-1.0.1 db/migrate/20140606072225_migrate_existing_date.rb
tasuku-0.1.1 db/migrate/20140606072225_migrate_existing_date.rb