I have a Ruby on Rails application that was created using:
rails new old_name -d mysql
Now I want to change the application name to be
You might find yourself having to rename the app when wanting or having to generate a model or scaffold with the same name as the app's name. Just happened to me. Used https://github.com/morshedalam/rename on Rails 3.2.13 and no problems so far.
Run the following to replace the old_name for new_name from the root of your Rails (3.0.7) project.
replace old_name new_name -- ./config/environment.rb ./config/application.rb ./Rakefile ./config/initializers/secret_token.rb ./config/environments/production.rb ./config/environments/development.rb ./app/views/layouts/application.html.erb ./config/routes.rb config.ru ./config/environments/test.rb ./config/initializers/session_store.rb
But be sure to run
fgrep old_name . -iR
Or something similar first to check if there are no occurrences of old_name in your project who not should be replaced.
EDIT:
Of course for this you need to have the replace command installed.
And take in account that your appname will be CamelCased, so maybe you have to try a few different variations, like OldName vs. NewName.
Rails 3 application can rename using https://github.com/morshedalam/rename
There's a Rails plugin to do it for you. Super convenient.
https://github.com/get/rename
To do this, I have used good old shell commands :
grep -r old_name * | cut -d: -f1 | xargs sed -i .bak 's/old_name/new_name/g'
This command replace the old_name with new_name in all file it finds the old_name. However, it creates a backup file with the extension '.bak'. Those file can be easily removed once you check everything went well.
The advantage of this, is that it is not 'rails version dependent'.
In Rails 3, there are references to the application name in the following files: