Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Mongoid #5

Open
mbulat opened this issue Mar 12, 2012 · 7 comments
Open

Support for Mongoid #5

mbulat opened this issue Mar 12, 2012 · 7 comments

Comments

@mbulat
Copy link
Owner

mbulat commented Mar 12, 2012

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.

@knewter
Copy link
Contributor

knewter commented Mar 12, 2012

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

@odigity
Copy link

odigity commented Jul 15, 2012

+1 on mongoid support

@knewter
Copy link
Contributor

knewter commented Jul 15, 2012

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 :)

@rileytg
Copy link

rileytg commented Feb 10, 2014

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

/cc @mbulat

@rthbound
Copy link
Contributor

@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?

@holgersindbaek
Copy link

+1 for Mongoid support.

@holgersindbaek
Copy link

Is someone working on implementing Mongoid for Plutus?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants