'ActiveRecord migration - when reversible.up/reversible.down feature was introduced?
I'm currently in the process of upgrading old legacy Rails app and trying to find the exact version number when this reversible.up, reversible.down block feature was introduced.
class SplitNameMigration < ActiveRecord::Migration
def change
add_column :users, :first_name, :string
add_column :users, :last_name, :string
reversible do |dir|
User.reset_column_information
User.all.each do |u|
dir.up { u.first_name, u.last_name = u.full_name.split(' ') }
dir.down { u.full_name = "#{u.first_name} #{u.last_name}" }
u.save
end
end
end
end
Does anyone know?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
