DEV Community

Robin Vernon
Robin Vernon

Posted on

Renaming a Rails app

Have you ever began a project without having a solid name picked out? I'm sure all of us have at least once. This is completely ok, we shouldn't just let inspiration fade because we can't think of a application name. Once an appropriate name sticks with you, it's time to rename your application. When trying you do this manually, you'll find that this really isn't an easy thing to do. However, thanks to Morshed Alam's "rename" gem , all the dirty work is done for us. This gem goes through your application and relabels where appropriate.
HOW TO:

  1. Add this to your gemfile

gem "rename"

  1. Rename your app

rails g rename:app_to updated_name

  1. Optional Rename your Database (in order to do this, you must be logged into Postgresql)

ALTER DATABASE db_name RENAME TO new_db_name

And Voila, you're done. Please note that the app you're currently in will no longer be useable. Navigate to the directory this file is in and your newly named app should be there!

Is there anything that you would do differently? Did this work for you? Open to feedback Devs!

Top comments (0)