I am building a JSON-only application, it is basically a leaner Rails, with fewer middleware and fewer modules. This is an application being built in Rails 4.
I want to to develop a simple app that can administrate the data in the database for the main-app. For this I would like to use Active Admin or Rails Admin. But both options somehow use the underlying models and their validations, requirements and such to build on top of.
This means that I need to share at least the models between the main application and the RailsAdmin application.
How would I best do this? Is there a good guide on how to build an administration-application in a separate rails app next to your main one, instead of having it integrated?
As a side note: another good reason to keep the admin in a separate application from the main app, but on a shared database, is the myriad of dependencies, a gem like ActiveAdmin comes with.
Also note that I am not simply interested in running admin on a different domain or different server, but mostly to keep main app lean and focused. And to keep the dependencies with which something like ActiveAdmin comes, out of my main app.
footnotes:
- Neither ActiveAdmin nor RailsAdmin are problems for performance in themselves. It's that they require middleware, whereas a JSON-only Rail-app, needs only very few modules, helpers and middleware! Rails-API, offers such a slim stack. Performance is not about Admin vs. no admin, but Full-Rails vs Rails-API.
- Performance is not my main problem, the dependencies and bloat is! I now have a Rails application that is so slim, focused and lean, that it can measure itself with most Sinatra apps :). With only three additional gems (each with a few dependencies of their own) and a very thin stack of middleware, I can upgrade, manage and debug very easily.
More practical: I don't have Devise (It's a JSON-API, so token-authenticated), don't have any views or template-engine. No Formtastic, No Paperclip, Rmagic, Kminari (pagers) and so on and so forth. All of which will be added to my app when I pull in "just an admin".