1

I am building a series of Rails applications for different use cases, but they all are using the same database schema. All the migrations and models are created in the Main app. What is a common approach in Rails to reuse models in other apps in order not to duplicate code?

2

1 Answer 1

2

What you're looking to do is called Multitenancy. Its explanation and numerous ways of implementation aren't suited to a short SO answer, since there are many different use cases.

There are many guides that show you how to do this, though, and I've listed a couple starting points below.

Alternatively, the Acts As Tenant gem will attempt to abstract this pain away from you (mostly).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.