views:

65

answers:

3

Is there a way to rename the application in Rails 2?

A: 

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.

True Soft
.project file? I've never heard of such a thing, and I just created a dummy rails project to test and can't find that file. Can you elaborate on that?
Faisal
This probably only exists for a particular IDE.
Ryan Bigg
If there isn't such a file, then just rename the directory. It must be from eclipse.
True Soft
+1  A: 

just rename the application directory, nothing more. I did it several times, no issues.

apeacox
A: 

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.

Chris