Changing Your Rails Project Name

December 15, 2013

A while ago I wanted to change a Rails project name. Since the project was well underway, it wasn’t easy to find the locations. Where does a project’s name appear in freshly generated code? (I studied this under Rails 4.0.0.rc1.)

I found that the project name appears in the following places:

app/views/layouts/application.html.erb : 4

    <title>ProjectName</title>    
    

config/application.rb : 9

    module ProjectName
    

config/database.yml : various

  1. The database names for all configurations (development, production, and test) are based on the project name.
  2. The usernames (if any) in all configurations are the project name.

config/environment.rb : 5

    ProjectName::Application.initialize!
    

config/environments/*.rb : 1

All environment files start with:

    ProjectName::Application.configured do
    

config/initializers/secret_token.rb : 12

    ProjectName::Application.config.secret_key_base = 'the_key'
    

config/initializers/session_store.rb : 3

    ProjectName::Application.config.session_store :cookie_store, key: '_ProjectName_session'
    

config/routes.rb : 1

    ProjectName::Application.routes.draw do
    

Rakefile : 6

    ProjectName::Application.load_tasks
    
Tags: rails
comments powered by Disqus