Skip to content

Commit eded54b

Browse files
Fix rails new --dev APP_PATH command crashing
ref: rails#47435 (comment) - `rails new APP_PATH --dev` works fine. - `rails new --dev APP_PATH` does not work. For most other flags, putting the APP_PATH before or after the flags has the same effect. It's just the prelease ones that have issues, because we have to rengerate the command so as to call `bundle exec rails new ...` a second time. Prior to this PR, the command that was being called was `bundle exec rails new APP_PATH APP_PATH`, and that doesn't work. Now it will get called as `bundle exec rails new APP_PATH --dev APP_PATH` which is fine. I haven't been able to find a way to write an automated test for this, but you can use the replication steps in rails#47435 to verify that the issue is fixed. Co-authored-by: Jonathan Hefner <[email protected]>
1 parent 3dd5d49 commit eded54b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

railties/lib/rails/generators/app_base.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,8 @@ def target_rails_prerelease(self_command = "new")
629629

630630
run_bundle
631631

632-
@argv[0] = destination_root
632+
@argv.delete_at(@argv.index(app_path))
633+
@argv.unshift(destination_root)
633634
require "shellwords"
634635
bundle_command("exec rails #{self_command} #{Shellwords.join(@argv)}")
635636
exit

0 commit comments

Comments
 (0)