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 new 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
initializers/secret_token.rb
initializers/session_store.rb

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

Edited 21 Sept 2010: to update per reader comments below.

  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.

  2. Androme Says:

    This is a nice and precise info on the subject. legal studies degree online fire science school public administration school Law Degree Law and legal studies school Law Degree

  3. esther91 Says:

    Thanks very much for the very clear instructions.
    proactol plus

  4. esther91 Says:

    Thanks very much for the very clear instructions.
    proactol plus

  5. seadh Says:

    The command is “rails new app_name” to create an app.

  6. Daze Says:

    The command is “rails new app_name” to create an app.

    good post though -

  7. eric Says:

    I realize this post is out of date, so here’s an update

    remove:
    script/console
    script/dbconsole
    from the list

    add:
    initializers/secret_token.rb
    initializers/session_store.rb
    to the list

  8. Mikel Lindsaar Says:

    @Kieran, @Daze and @eric thanks! I have updated. the post to match.

  9. Veeti Paananen Says:

    You should add the Rakefile to your list again. Thanks!

  10. Andrey Esaulov Says:

    Thank you so much! That saved my day!

  11. G. Koren Says:

    You can use the Rename plugin

    https://github.com/get/Rename

  12. gift baskets Says:

    This is exactly the good that I have been looking, Thanks for this. Thanks for the codes.

  13. gift baskets Says:

    This is exactly the good that I have been looking, Thanks for this. Thanks for the codes.

  14. asdg4dfg 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 sg ksygnnvhg hg tthjobhmt te zipoxihuu

  15. Demir Leather Says:

    I had joined a multicultural choir Suara Mas, where we sang songs in all the languages of Malaysia.

  16. Funeral Says:

    I had joined a multicultural choir Suara Mas, where we sang songs in all the languages of Malaysia.

  17. astrologie Says:

    However I’d like to think that it’s more to me than just sales and I have for example this winter acquired a taste for cross country skiing.

  18. Lebanon Web Design Says:

    The Coffee Shop, operated by the Scudamores on Gloucester.

  19. cat scores Says:

    I have been looking, Thanks for this. Thanks for the codes.

  20. http://www.accidentsdirect.com Says:

    Of course, if you are using TextMate, a simple Project wide search and replace for AppName with your new name, should do the trick.

  21. jibran Says:

    The best person to give you medical advice about liver disease is your doctor. Best thing we can do is recommend perhaps a good doctor if you need a second or third opinion. casino

  22. dsfg34yt Says:

    Of course, if you are using TextMate, a simple Project wide search and replace for AppName with your new name, should do the trick.thislifes fg askedcool tr gudena

  23. jibran Says:

    I think we need to bring more ideas for this purpose. Involvement of young people can be handy in this regard. I am happy to find a good post here. BMI calculator

  24. BernardII Says:

    Thanks for posting this useful information. This was just what I was on looking for. I’ll come back to this blog for sure! I bookmarked this blog a while ago because of the useful content . How to Market your Business

  25. sailing yacht charter Says:

    it is easy to do it. I am sure that I can do it myself.

  26. timeshare for sale Says:

    I will try to name it like you said. I am sure that this is the best approach. I will read more about it.

  27. rotary hammer Says:
    where we sang songs in all the languages of Malaysia. I had joined a multicultural choir Suara Mas,
  28. outdoor chairs Says:

    I bookmarked this blog a while ago because of the useful content ..
    outdoor chairs

  29. cheap car finance Says:

    d the detail were just perfect. I think that your perspective is deep, its just well thought out and really fantastic to see someone who knows how

  30. abercrombie paris Says:

    This is a great post ! it was very informative. I look forward in reading more of your work. Also, I made sure to bookmark your website so I can come back later. I enjoyed every moment of reading it.

  31. Immobilienmakler Says:

    choir Suara Mas, where we sang songs in all the languages of Malaysia.d

  32. bwl fernstudium Says:

    I have been looking, Thanks for this. Thanks for the codes.

  33. make your own website Says:

    it was very informative. I look forward in reading more of your work. sdfsfds
    make your own website

  34. Buchhalter Says:

    a nice and precise info on the subject.

  35. Karmaloop Promo Codes Says:

    I love the way you write and share your niche! Very interesting and different! Keep it coming!

  36. asddas Says:

    This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself,.
    gluten free

  37. Heilpraktiker Ausbildung Says:

    that eliminated some of these locations you need to change.

  38. asdsd Says:

    Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks.
    lupus symptoms

  39. Michael Jackson Lyrics Says:

    But it is something to be aware of.F

  40. 5 htp mg dosage Says:

    you’ve always shared with us. Just keep writing this kind of posts.The time

Leave a Reply