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

Already on GitHub? Sign in to your account

Fixed instance "saved" attribute in mongodb adapter #170

Merged
merged 1 commit into from Aug 14, 2012

Conversation

Projects
None yet
3 participants
Contributor

djrenren commented Aug 14, 2012

Previously, instances were stored in the database with instance.saved = false. Even when they were obviously saved.

This commit fixes that issue. The problem was that we were setting

instance.saved = true

and then saving cleanInstance to the database.

Now it sets both instance.saved and cleanInstance.saved

Contributor

djrenren commented Aug 14, 2012

We may not want to be saving it all (seeing as it's redundant). Should we just drop the "saved" attribute?

Contributor

larzconwell commented Aug 14, 2012

@mde is currently writing an ORM that's going to be used in Geddy so this may not be needed here anymore. But I'm not sure what he'd want to do here ATM.

Contributor

mde commented Aug 14, 2012

Yes, I'm pulling all the Geddy model stuff out into its own project, "Model": https://github.com/mde/model But the 'saved' attribute is what the ORM uses to know if the instance is a new one, or has been previously saved. (We might consider making it an underscore property: "_saved".)

@mde mde added a commit that referenced this pull request Aug 14, 2012

@mde mde Merge pull request #170 from jmrenner/master
Fixed instance "saved" attribute in mongodb adapter
b68adda

@mde mde merged commit b68adda into geddy:master Aug 14, 2012

Contributor

mde commented Aug 14, 2012

In the meantime, at least the current Geddy model stuff will behave correctly. Saving something in the DB with "saved" = false is crazypants. :)

Contributor

djrenren commented Aug 14, 2012

w00t my first accepted pull request! :D If you're looking for help with Model just lemme know.

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