Sha256: 45a4a1deab1ee6448b981ddd84afe058979a6b28260e0623d51413a51ae8c85a

Contents?: true

Size: 448 Bytes

Versions: 4

Compression:

Stored size: 448 Bytes

Contents

class MigratePolymorphicRelations < ActiveRecord::Migration
  class Tasuku::Task < ActiveRecord::Base
    self.table_name = 'tasks_tasks'
  end

  def up
    Tasuku::Task.all.each do |task|
      task.taskable_type = task.taskable_type.gsub "Tasks::", "Tasuku::"
      task.save
    end
  end

  def down
    Tasuku::Task.all.each do |task|
      task.taskable_type = task.taskable_type.gsub "Tasuku::", "Tasks::"
      task.save
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tasuku-1.1.0 db/migrate/20140606112652_migrate_polymorphic_relations.rb
tasuku-1.0.1 db/migrate/20140606112652_migrate_polymorphic_relations.rb
tasuku-0.1.1 db/migrate/20140606112652_migrate_polymorphic_relations.rb
tasuku-0.1.0 db/migrate/20140606112652_migrate_polymorphic_relations.rb