Is there a way to rename the application in Rails 2?
Rename the directory of the project to the new name, then in .project
file in that directory change the name in the projectDescription/name
tag:
<projectDescription>
<name>new_name</name>
The only place where the old name still exists is in config\initializers\session_store.rb
in the session key, you can rename that too, if you want.
just rename the application directory, nothing more. I did it several times, no issues.
Rails 2 doesn't really have a concept of an application 'name'. The only thing that identifies your app is the name of the folder itself.
In Rails 3, it's a little different. Rails 3 projects are name-spaced to a module defined in config/application.rb
. This application module is used to house your app, and you'll see it referenced by your config.ru
, config/routes.rb
, config/environment.rb
and all the environments defined in config/environments/
.
If you were to open a terminal session and run the command rails new myapp
, your config/application.rb
file would define the module Myapp
, inside which will be defined an Application class, which extends Rails::Application. All the other files will reference Myapp::Application
.
In both Rails 2 and 3, you will find a string key for your session defined in config/initializers/session_store.rb
, which takes the default value of '_<myapp>_session'. It's not really tied to the "name" of your application, though you should try to keep it in sync to prevent any accidental session key name conflicts with other apps.