Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --name option to the app generator #44941

Merged

Conversation

nicolasiensen
Copy link
Contributor

@nicolasiensen nicolasiensen commented Apr 22, 2022

Summary

In this pull request, we are adding the option to set the name of the app when generating a new one with rails new.

The option --name will override the application name to be different from the folder name.

rails new my-app-folder --name=my-actual-app-name

The command above will generate a new Rails application in the folder my-app-folder, but the file config/application.rb will have the following structure:

module MyActualAppName
  class Application < Rails::Application
  end
end

This option would be most useful when generating a Rails application in the current folder:

rails new . --name=my-app

Other Information

n/a

In this commit, we are adding the option to set the name of the app
when generating a new one with `rails new`.

The option `--name` will override the application name to be different
from the folder name.

```
rails new my-app-folder --name=my-actual-app-name"
```

The command above will generate a
new Rails application in the folder `my-app-folder`, but the file
`config/application.rb` would have the following structure:

module MyActualAppName
  class Application < Rails::Application
  end
end

This option would be most useful when generating a Rails application in
the current folder:

```
rails new . --name=my-app
```
@rails-bot rails-bot bot added the railties label Apr 22, 2022
@tenderlove tenderlove merged commit 89471b2 into rails:main Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants