Renaming a Rails 4 app

2019-05-10 10:42发布

I have created a Rails 4 app but the name has since changed.

I have updated the folder name, but I was wondering what files do I need to go into and update to have this new name throughout the site, or if there is rails command that will do this quickly and easily.

3条回答
走好不送
2楼-- · 2019-05-10 11:13

Add gem 'rename' to Gemfile then do bundle install .

After bundle install
rails g rename:app_to name_of_app

And if you are using mongoid then you need to rename the database name in config/mongoid.yml

查看更多
一纸荒年 Trace。
3楼-- · 2019-05-10 11:16

You should search the directory for all instances of the app name:

ack "app-name" and figure out what each one is doing. You will often times have named spaced modules under the old name.

config.ru and config/application.rb for sure should be checked.

查看更多
唯我独甜
4楼-- · 2019-05-10 11:23

https://github.com/morshedalam/rename - I posted an issue there for you. It was great for me with rails 3.

survey says... it works great with Rails 4!!

查看更多
登录 后发表回答