rails

Be Careful to Prevent File Overwriting with rails g

Shou Arisaka
2 min read
Nov 22, 2025
Overwrite C:/pg/RAILS/dev___/app/controllers/dev_controller.rb? (enter "h" for help) [Ynaqdh] h
        Y - yes, overwrite
        n - no, do not overwrite
        a - all, overwrite this and all others
        q - quit, abort
        d - diff, show the differences between the old and the new
        h - help, show this help
Overwrite C:/pg/RAILS/dev___/app/controllers/dev_controller.rb? (enter "h" for help) [Ynaqdh] Y
       force  app/controllers/dev_controller.rb
       route  get 'dev/create'
get 'dev/update'
      invoke  erb
       exist    app/views/dev
      create    app/views/dev/create.html.erb
      create    app/views/dev/update.html.erb
      invoke  test_unit
    conflict    test/controllers/dev_controller_test.rb
  Overwrite C:/pg/RAILS/dev___/test/controllers/dev_controller_test.rb? (enter "h" for help) [Ynaqdh] Y
       force    test/controllers/dev_controller_test.rb
      invoke  helper
   identical    app/helpers/dev_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    coffee
   identical      app/assets/javascripts/dev.coffee
      invoke    scss
   identical      app/assets/stylesheets/dev.scss

Meaning of each English word:

identical - same exist - exists invoke - call conflict - conflicting force - forcefully create - create

What you want to be careful about here is force.

Files displayed as force are those that have been overwritten.

Overwriting means that the code you had written before will be erased, so you really need to be careful.

That said, before force, there's a confirmation asking if you want to overwrite, so if you read the English properly here, you can avoid it.

Basically, n should be fine, but if you're concerned, you can also see the difference with d.

Share this article

Shou Arisaka Nov 22, 2025

๐Ÿ”— Copy Links