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

schema migrations work as instances

This commit is contained in:
Aaron Patterson 2010-11-17 13:31:43 -08:00
parent 8b2f801ed8
commit 0bea9fd6be
3 changed files with 11 additions and 6 deletions

View file

@ -288,12 +288,15 @@ module ActiveRecord
#
class Migration
class << self
attr_accessor :verbose
attr_accessor :delegate # :nodoc:
def method_missing(name, *args, &block) # :nodoc:
end
def self.method_missing(name, *args, &block) # :nodoc:
(delegate || superclass.delegate).send(name, *args, &block)
end
end
cattr_accessor :verbose
self.delegate = new
self.verbose = true

View file

@ -46,11 +46,12 @@ module ActiveRecord
# ...
# end
def self.define(info={}, &block)
new.instance_eval(&block)
schema = new
schema.instance_eval(&block)
unless info[:version].blank?
initialize_schema_migrations_table
assume_migrated_upto_version(info[:version], migrations_path)
assume_migrated_upto_version(info[:version], schema.migrations_path)
end
end
end

View file

@ -19,6 +19,7 @@ if ActiveRecord::Base.connection.supports_migrations?
class <<self
attr_accessor :message_count
end
def puts(text="")
self.class.message_count ||= 0
self.class.message_count += 1