aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration
diff options
context:
space:
mode:
authorNishant Modak <modak.nishant@gmail.com>2014-01-06 14:34:22 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2014-01-07 15:57:21 +0530
commiteb589fed6f4950d441bc6aed8dfaaeffec061322 (patch)
tree6f35a27cb573624ec453a5f8e5c303bb524fcf72 /activerecord/lib/active_record/migration
parent017b0fb08a221fe6b1bb73946c3e365daf80bb39 (diff)
downloadrails-eb589fed6f4950d441bc6aed8dfaaeffec061322.tar.gz
rails-eb589fed6f4950d441bc6aed8dfaaeffec061322.tar.bz2
rails-eb589fed6f4950d441bc6aed8dfaaeffec061322.zip
Make change_table use object of current database adapter
- Earlier, change_table was creating database-agnostic object. - After this change, it will create correct object based on current database adapter. - This will ensure that create_table and change_table will get same objects. - This makes update_table_definition method public and nodoc. - Fixes #13577 and #13503
Diffstat (limited to 'activerecord/lib/active_record/migration')
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index 01c73be849..17300f0598 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -86,7 +86,7 @@ module ActiveRecord
alias :remove_belongs_to :remove_reference
def change_table(table_name, options = {})
- yield ConnectionAdapters::Table.new(table_name, self)
+ yield delegate.update_table_definition(table_name, self)
end
private
@@ -159,9 +159,11 @@ module ActiveRecord
# Forwards any missing method call to the \target.
def method_missing(method, *args, &block)
- @delegate.send(method, *args, &block)
- rescue NoMethodError => e
- raise e, e.message.sub(/ for #<.*$/, " via proxy for #{@delegate}")
+ if @delegate.respond_to?(method)
+ @delegate.send(method, *args, &block)
+ else
+ super
+ end
end
end
end