You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've seen that sequel support was added fairly early on with #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?
The text was updated successfully, but these errors were encountered:
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 itself.adapter=Trestle::Adapters.compose(MongoidAdapter)end
I've seen that sequel support was added fairly early on with #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?
The text was updated successfully, but these errors were encountered: