我有一个Rails网站,它被分成两个独立的项目 - 公共站点和管理站点。
由于两个站点使用相同的数据库,模型在应用程序之间共享(实际上现在它们被复制)。我在这里遇到的问题是,当公共项目中出现模型更新时,我需要将更改复制到管理项目中。
我已经有了一个看看周围所以,并注意到有一个问题有答案建议使用svn:external或git子模块,但我不完全确定如何执行此操作。
本质上,我的目标是能够仅在一个位置进行更改,将这些更改提交到 git ,然后当我需要更新时,能够在另一个项目中提取更改。
解决方案不要使用子模块。他们很丑,很难理解和维护。
Git子树是Git 1.7.11以来的一部分,我写了一篇关于在Rails应用程序之间共享代码的文章: http:// igor -alexandrov.github/blog/2013/03/28/using-git-subtree-to-share-code-between-rails-applications/ <总之:是的,git-subtree的工作原理非常棒!
I have a Rails website which has been divided into two separate projects - the public site, and the administration site.
As both sites are using the same database the models are shared between the applications (actually right now they are duplicated). The problem I have here is that when an update to the models occurs in the public project I need to copy the changes over into the admin project.
I've had a look around SO and noticed that there was a question which had answers suggesting using svn:external or git submodule, but I'm not entirely sure how to do this.
Essentially my aim is to be able to make the changes in one place only, commit those changes to git and then be able to pull the changes in the other project when I need to update that as well.
解决方案Do not use submodules. They are ugly, hard to understand and to maintain. Much better is to use subtrees.
Git subtree is a part of GIT since 1.7.11 and I wrote an article about sharing code between Rails applications: igor-alexandrov.github/blog/2013/03/28/using-git-subtree-to-share-code-between-rails-applications/
In short: yes git-subtree works and works great!
更多推荐
在两个Rails项目之间共享模型
发布评论