Ensure seeds are applied in an ORM-agnostic manner #1069

Merged
merged 5 commits into from Apr 15, 2012

Conversation

Projects
None yet
2 participants
Contributor

timkurvers commented Apr 7, 2012

To ensure future ORMs can have seed data, this pull-request ensures that all operations go through the abstract model. AbstractModel#where has been added which defaults to ActiveRecord/MongoID find-behaviour.

Suggestions more than welcome :)

Collaborator

mshibuya commented Apr 8, 2012

I agree, this kind of abstraction is surely needed for DataMapper support 👍
But assigning AbstractModel's instances to constants(such as AgonisticUser) might be a bit confusing.
Using local variables instead will be simpler, in my personal view.

And we need a test for AbstractModel#where method!

Contributor

timkurvers commented Apr 8, 2012

Good point about the constants. Any proposals? A local such as abstract_user_model for example?

Had completely forgotten about the test. Might have to familiarize myself with the test suite, but eventually there shall be one!

Collaborator

mshibuya commented Apr 9, 2012

Yeah, abstract_user_model or user_model should be just fine, I guess.

Please update this pull request if you have done with writing tests. Then I'll merge this in.

Contributor

timkurvers commented Apr 15, 2012

Have added the specs and tweaked the variable names :)

mshibuya added a commit that referenced this pull request Apr 15, 2012

Merge pull request #1069 from timkurvers/seeds-orm-agnostic
Ensure seeds are applied in an ORM-agnostic manner

@mshibuya mshibuya merged commit c2c4f91 into sferik:master Apr 15, 2012

Collaborator

mshibuya commented Apr 15, 2012

Merged.
Thanks for your work, and good luck with implementing DataMapper support!

Contributor

timkurvers commented Apr 17, 2012

Thank you for the work on abstraction, sheer awesomeness :)

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