Mongoid support
I've seen that sequel support was added fairly early on with https://github.com/TrestleAdmin/trestle/issues/2 and was thinking if something similar could be done with mongoid. Do you see any possible issues with that? (e.g. would things like different mongo document "fields" per record break some assumptions that view templates currently have?)
For now I'll assume that following the example adapter file, a mongo adapter could be made. But this brings another question - can I use multiple adapters in the same project? E.g. I have some ActiveRecord models (in various databases) + some Mongoid documents. I only see a way on how a default_adapter could be set for all resources, but can I set it per Trestle resource?
As long as the ORM layer is ActiveModel compatible (which I believe Mongoid is), then a custom adapter should be possible. I'd certainly be very happy to accept a PR with Mongoid support if you are able.
Nested objects that are sometimes found within MongoDB may be tricky to handle -- you may have success searching the issue tracker for 'nested' to see how it is handled with ActiveRecord (and accepts_nested_attributes_for), and seeing if something similar can be applied to Mongoid, but that will probably be separate from the adapter itself.
For the second part of your question, adapters can be overridden at the Resource level, e.g.
Trestle.resource(:mongoid_resource) do
# Adapters.compose creates a new class and includes each of the modules passed to it
self.adapter = Trestle::Adapters.compose(MongoidAdapter)
end
I tried to connect this adapter through the sequel, but nothing works for me. If anyone managed to do this, please share the connection steps