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

Mongoid compatibility #80

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Mongoid compatibility #80

wants to merge 4 commits into from

Conversation

GUI
Copy link

@GUI GUI commented Sep 3, 2014

I'm not entirely sure if you're interested in this, or if this even belongs in seed-fu, but I thought I'd submit this pull request to get feedback.

This adds support for seeding Mongoid models with seed-fu. Mongoid models act a lot like ActiveRecord models, so there wasn't a terrible amount that had to change. A few things had to be wrapped in conditionals based on the model class type, but otherwise the core logic worked fine under Mongoid. All tests pass against Mongoid and continue to pass against ActiveRecord.

Is this something you'd be interested in integrating into seed-fu proper, or do you think this functionality would be better suited for a separate mongoid-only gem?

For reference, there is an existing seed-fu-mongoid project that looks to accomplish the same thing for mongoid only. However, I ran into a couple bugs with that project (seed constraints for anything other than id seem broken), so I decided to take a quick gander at integrating this functionality directly into seed-fu.

This is to solve issues in Mongoid apps where ActiveRecord is disabled.
Some other gems were simply checking for the existence of
ActiveRecord::Base and then were trying to operate on the ActiveRecord
connection. This change should prevent the seed-fu library from
requiring ActiveRecord in a non-ActiveRecord Rails app.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant