Sha256: 5f5673026f0ac8d5f2cd04d55fd1d99b9335ca315ea84c06cae4652e25f12e0e

Contents?: true

Size: 627 Bytes

Versions: 3

Compression:

Stored size: 627 Bytes

Contents

class MigrateResponses < ActiveRecord::Migration
  def up
    %w(Image::Response Question::Answer Text::Response URL::Response Verification::Confirmation).each do |class_name|
      "Tasuku::Taskables::#{class_name}".constantize.all.each do |model|
        if model.request.task.present?
          Tasuku::Taskables::Taskable::Response.create! do |response|
            response.author      = model.author
            response.submittable = model
            response.task        = model.request.task
          end
        end
      end
    end
  end

  def down
    Tasuku::Taskables::Taskable::Response.destroy_all
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tasuku-1.1.0 db/migrate/20140613115558_migrate_responses.rb
tasuku-1.0.1 db/migrate/20140613115558_migrate_responses.rb
tasuku-0.1.1 db/migrate/20140613115558_migrate_responses.rb