Yes, renaming a Rails application isn’t something that you’ll do often. But when you do have to do it, you’ll quickly realize that it’s not as easy as just changing the name in a file or two. Your application name is spread out through a few dozen files including environment configs, initializers, routes and our application.rb file.
Luckily you don’t have to remember which files to change. Morshed Alam created a gem (appropriately named Rename) that handles the grunt work for you. Rename goes through your app and performs a gsub
where appropriate.
To Rename Your Application
Add this line to your Gemfile:
1
|
|
Rename the app:
1
|
|
This will rename the app in all of these files:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
You’ll probably want to rename your databases while you are at it.
For Postgresql, log into psql and then:
1
|
|
Enjoy!