diff options
Diffstat (limited to 'activerecord/lib/rails/generators/active_record/migration/migration_generator.rb')
-rw-r--r-- | activerecord/lib/rails/generators/active_record/migration/migration_generator.rb | 8 |
1 files changed, 4 insertions, 4 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 1de2aff632..1f1c47499b 100644 --- a/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +++ b/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb @@ -10,7 +10,7 @@ module ActiveRecord def create_migration_file set_local_assigns! validate_file_name! - migration_template @migration_template, "db/migrate/#{file_name}.rb" + migration_template @migration_template, File.join(db_migrate_path, "#{file_name}.rb") end # TODO Change this to private once we've dropped Ruby 2.2 support. @@ -23,7 +23,7 @@ module ActiveRecord # Sets the default migration template that is being used for the generation of the migration. # Depending on command line arguments, the migration template and the table name instance # variables are set up. - def set_local_assigns! # :doc: + def set_local_assigns! @migration_template = "migration.rb" case file_name when /^(add|remove)_.*_(?:to|from)_(.*)/ @@ -42,13 +42,13 @@ module ActiveRecord end end - def set_index_names # :doc: + def set_index_names attributes.each_with_index do |attr, i| attr.index_name = [attr, attributes[i - 1]].map { |a| index_name_for(a) } end end - def index_name_for(attribute) # :doc: + def index_name_for(attribute) if attribute.foreign_key? attribute.name else |