diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-17 13:31:43 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-17 14:26:34 -0800 |
commit | 0bea9fd6be1c82154d7b2d4adbfc690a2c1df297 (patch) | |
tree | db63f369f5d9ab528c61b0bf19854a412f617b4d /activerecord/lib/active_record | |
parent | 8b2f801ed8690dcbc61d62e6b3518efaac70a4a4 (diff) | |
download | rails-0bea9fd6be1c82154d7b2d4adbfc690a2c1df297.tar.gz rails-0bea9fd6be1c82154d7b2d4adbfc690a2c1df297.tar.bz2 rails-0bea9fd6be1c82154d7b2d4adbfc690a2c1df297.zip |
schema migrations work as instances
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 11 | ||||
-rw-r--r-- | activerecord/lib/active_record/schema.rb | 5 |
2 files changed, 10 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index 4a1a84b74b..390c24c2f2 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -288,12 +288,15 @@ module ActiveRecord # class Migration class << self - attr_accessor :verbose attr_accessor :delegate # :nodoc: - def method_missing(name, *args, &block) # :nodoc: - (delegate || superclass.delegate).send(name, *args, &block) - end end + + def self.method_missing(name, *args, &block) # :nodoc: + (delegate || superclass.delegate).send(name, *args, &block) + end + + cattr_accessor :verbose + self.delegate = new self.verbose = true diff --git a/activerecord/lib/active_record/schema.rb b/activerecord/lib/active_record/schema.rb index a621248cc3..c6bb5c1961 100644 --- a/activerecord/lib/active_record/schema.rb +++ b/activerecord/lib/active_record/schema.rb @@ -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 |