I am just getting started in a Rails project after a long time in the PHP world.
This project is in a very early stage, meaning that is a good time to do major changes, and currently comprises two different rails modules, one for administrators and one for users, both in separate rails instances. What I would like to do is to merge both projects into a single rails instance, which I believe it will improve the manageability of the application in the long run.
Both instances share the same database and each of them has a devise model for authentication. I have been documenting myself about ways of merging both projects and I came up with two alternatives: the first would be to create two namespaces, one for users and another one for admins, and share the model and framework logic. the second one would be to create engines for admins and users, which seems to be cleaner but much more complex.
I have read a lot documentation and I am experimenting with rails, but at this point I am in need of a more experienced opinion.
Thank you in advance, and I appreciate your thoughts on this.
Both namespaces and engines have pros and cons. Which one to use will come down to your particular use case. For the most part, I recommend using namespaces as it tends to be easier and saves some headaches. Especially when sharing a data model. However, engines are great when you want to share common isolated behavior in multiple applications.
Pros
Cons
Isolate related functionality
benefit.Pros
Cons
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With