How to rename a Rails 3 Application

Tue Jan 19 14:01:00 -0800 2010

Renaming a Rails 3 application is something you have to think about now. No, really… :)

When you create a new Rails 3.0 app with “rails app_name” Rails will create the application for you like before, but with a major difference.

It will Classify your “app_name” and use this as the Ruby name space for your application.

So if you do:

rails app_name

Then your Rails application will have sprinklings of AppName throughout the tree.

If you later decide that your application should be called something more specific than “AppName” you need to replace out AppName from the following files:

config/application.rb
config/environment.rb
config/environments/development.rb
config/environments/test.rb
config/environments/production.rb
config/routes.rb
config.ru
Rakefile
script/console
script/dbconsole

Of course, if you are using TextMate, a simple Project wide search and replace for AppName with your new name, should do the trick. But it is something to be aware of.

blogLater

Mikel

  1. Kieran P Says:

    There was a commit recently that eliminated some of these locations you need to change. The last 3 on your list (Rakefile, and script/*) now point to Rails::Application, Rails::Console, or Rails::DBConsole, and not AppName anymore.

Leave a Reply