diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index f0dca080c0..96e68b6c88 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -503,7 +503,7 @@ module ActiveRecord def remove_origin_comment(migration_source) if migration_source =~ /^# This migration comes from/ - migration_source = migration_source.to_a[1..-1].join + migration_source = migration_source.lines.to_a[1..-1].join end migration_source diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index fb49dccbd3..e27a1ff535 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -2258,7 +2258,7 @@ if ActiveRecord::Base.connection.supports_migrations? # remove origin comment migration = @migrations_path + "/4_people_have_hobbies.rb" - migration_source = File.read(migration).to_a[1..-1].join + migration_source = File.read(migration).lines.to_a[1..-1].join File.open(migration, "w") { |f| f.write migration_source } ActiveRecord::Migration.copy(@migrations_path, sources, :on_skip => on_skip)