1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

convertion MigrationProxy to a Struct, initialize instance variables

This commit is contained in:
Aaron Patterson 2010-10-03 16:32:27 -07:00
parent 341e71a1b9
commit e6583901e5

View file

@ -419,9 +419,12 @@ module ActiveRecord
# MigrationProxy is used to defer loading of the actual migration classes # MigrationProxy is used to defer loading of the actual migration classes
# until they are needed # until they are needed
class MigrationProxy class MigrationProxy < Struct.new(:name, :version, :filename, :scope)
attr_accessor :name, :version, :filename, :scope def initialize(name, version, filename, scope)
super
@migration = nil
end
delegate :migrate, :announce, :write, :to=>:migration delegate :migrate, :announce, :write, :to=>:migration
@ -518,11 +521,7 @@ module ActiveRecord
raise DuplicateMigrationNameError.new(name.camelize) raise DuplicateMigrationNameError.new(name.camelize)
end end
migration = MigrationProxy.new migration = MigrationProxy.new(name.camelize, version, file, scope)
migration.name = name.camelize
migration.version = version
migration.filename = file
migration.scope = scope
klasses << migration klasses << migration
end end