Mongoid compatibility - #80
Open
GUI wants to merge 4 commits into
Open
Conversation
Conflicts: seed-fu.gemspec
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
idseem broken), so I decided to take a quick gander at integrating this functionality directly into seed-fu.