aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/rails
diff options
context:
space:
mode:
authorGuilherme Reis Campos <guilhermekbsa@gmail.com>2017-08-02 23:41:41 +1000
committerGuilherme Reis Campos <guilhermekbsa@gmail.com>2017-08-03 17:16:22 +1000
commit1cc6c74db20de139f6ad3bedc7cd7e28dc83283e (patch)
treef7e358a1aae3fa623e44457e62a402ef45f8bbe7 /activerecord/lib/rails
parent090eaa7e1b42143ffdb42409aa5d429cbeb3e55d (diff)
downloadrails-1cc6c74db20de139f6ad3bedc7cd7e28dc83283e.tar.gz
rails-1cc6c74db20de139f6ad3bedc7cd7e28dc83283e.tar.bz2
rails-1cc6c74db20de139f6ad3bedc7cd7e28dc83283e.zip
Handling add/remove to/from migration edge cases
Making sure the table name is parsed correctly when an add/remove column migration have 'from'/'to' in the table name.
Diffstat (limited to 'activerecord/lib/rails')
-rw-r--r--activerecord/lib/rails/generators/active_record/migration/migration_generator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
index 0174c7ea31..856fcc5897 100644
--- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
+++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
@@ -28,7 +28,7 @@ module ActiveRecord
def set_local_assigns!
@migration_template = "migration.rb"
case file_name
- when /^(add|remove)_.*_(?:to|from)_(.*)/
+ when /^(add)_.*_to_(.*)/, /^(remove)_.*?_from_(.*)/
@migration_action = $1
@table_name = normalize_table_name($2)
when /join_table/