开发者

Possible to 'copy and paste' a whole Rails application?

开发者 https://www.devze.com 2023-02-04 14:26 出处:网络
I have a fully-functioning Rails application running on my local machine called \'first-app\' in my Rails applications folder \'rails-app开发者_运维技巧s\'. I would like to create a second application

I have a fully-functioning Rails application running on my local machine called 'first-app' in my Rails applications folder 'rails-app开发者_运维技巧s'. I would like to create a second application in rails-apps (called 'second-app') which is identical to first-app, just with a different name.

Can I simply copy-and-paste first-app and rename the folder to 'second-app'? I have found only two files in the whole application which contain the term 'first-app' (application.rb and routes.rb, both in config), so presumably I would have to change their contents as well. If this 'copy-and-paste' approach is viable, are there any other files I would have to alter?

If I have to do the usual > rails new second-app, I must be able to copy and paste a lot of the files and folders from first-app. Which are the ones that I have to manually alter or construct with a rails command?


yes, it should works! Just replace in the copy-project the old terms('first-app') to 'second-app' and create a new database for the new app.


You can copy and past the first app folder and use the gem 'rename' to rename the copied app. Follow these instructions: How to rename rails 4 app?


Just copy your app to a new folder :

$ cp your-old-app your-new-app

If you want to create a new database for the new app, in your config/database.yml rename the development database.

After that, all you have to do is rake db:create db:migrate

0

精彩评论

暂无评论...
验证码 换一张
取 消