Sharing models between two Rails projects - using git submodules?

I have a Rails site that has been split into two separate projects - a public site and an administration site.

Since both sites use the same database, the models are shared between applications (in fact, right now they are duplicated). The problem that I have here is that when updating in models occurs in a public project, I need to copy the changes to the admin project.

I looked around SO and noticed that there was a question that had answers suggesting to use svn: external or git subodule, but I'm "Not quite sure how to do this."

Essentially, my goal is to be able to make changes in only one place, commit those changes to git , and then be able to pull changes in another project when I need to update this as well.

+3
source share
2 answers

You need:

  • transfer submodule in one place
  • transfer the main project (said public website)
  • go to the same submodule in another main project (administrative site).
  • pulling out the last content (changing the HEAD of this submodule)
  • transition to one directory in the main (administrative) project
  • commit (record that you are now referencing a different version of the submodule)

. .

+1

Source: https://habr.com/ru/post/1742916/


All Articles