plutus icon indicating copy to clipboard operation
plutus copied to clipboard

Support for Mongoid

Open mbulat opened this issue 12 years ago • 7 comments

I'm opening this issue in order to keep track of updating / abstracting plutus to support Mongoid. I'd like to take an approach that will support other persistance mechanisms later on (Redis for example)

I think there are a number of questions to address prior to proceeding. I'll try to list a few, and please add any others that you can think of.

  1. How do we abstract out the models?
  2. Should the persistance mechanism be based on the parent app, or configurable without regard to app.
  3. Currently transactions support a "commercial document" relation which assume the parent app has a persisted model that we wish to relate to a transaction. If the persistance mechanisms are different, how do we handle that?

I'm not that familiar with Mongoid myself, but I'm under the impression that it is using ActiveModel under the hood, which means that it should already share an interface with ActiveRecord and anything else that extends ActiveModel. That being the case, I'm thinking that we simply have a Factory Class that generates the appropriate impl based on whatever configuration method we choose. Something like:

module Plutus
  module Factory
    case Plutus.persistence
    when :active_record
      class Transaction < Plutus::ActiveRecordPersistence::Transaction
      end
    when :mongoid
      class Transaction < Plutus::MongoidPersistence::Transaction
      end
    else
      raise "not implemented"
    end
  end
end

Controllers and what not then call Plutus::Factory:::Transaction.new or Plutus::Factory::Transaction.find(params), etc.

mbulat avatar Mar 12 '12 18:03 mbulat

This seems like a fine implementation to me, generally. We aim to play with it a bit and see where the cracks are...

knewter avatar Mar 12 '12 21:03 knewter

+1 on mongoid support

odigity avatar Jul 15 '12 16:07 odigity

So just an update - isotope11's fork has mongo support and we're using it in production, but we never did the work to get it mainline'd because the developer that was working on it isn't here anymore. If anyone wants to get that merged, we'll help any way we can :)

knewter avatar Jul 15 '12 17:07 knewter

@knewter any hopes this is still active and I can help merge to plutus?

/cc @mbulat

rileytg avatar Feb 10 '14 20:02 rileytg

@rileytg @mbulat

That fork/branch is here if I'm not mistaken. It looks like only 7 of 11 commits pertain to this feature. Is this still a desired feature?

rthbound avatar Jun 22 '15 16:06 rthbound

+1 for Mongoid support.

holgersindbaek avatar May 16 '16 23:05 holgersindbaek

Is someone working on implementing Mongoid for Plutus?

holgersindbaek avatar Jun 12 '16 02:06 holgersindbaek