Adding recursive #to_hash implementation and spec. #83

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

Makes API more consistent. Now, if record was created from
some hash, it will get serialized back to same hash.

Closes #82.

Adding recursive #to_hash implementation and spec.
Makes API more consistent. Now, if record was created from
some hash, it will get serialized back to same hash.

Closes #82.

Sorry, that one was silly.
I'll try again tomorrow.

@ifesdjeen ifesdjeen closed this Apr 16, 2012

Collaborator

dkubb commented Apr 17, 2012

Don't worry about it. The solution you made is exactly how I would've approached it at first. The fact that structures can be recursive wouldn't be obvious unless you've done it and released it into the wild.

If you need a hand or need some ideas on how to prevent infinite recursion, let me know. Here's a few pointers to get you started:

http://www.codebenders.com/code/preventing-recursion-in-ruby/
https://github.com/dkubb/ice_nine/blob/master/lib/ice_nine/support/recursion_guard.rb

Owner

solnic commented Apr 17, 2012

@ifesdjeen there's no such thing as a silly pull request, just like there are no stupid questions :) thanks for your work! Either @dkubb or me can help you with getting this feature done. Looking forward for the next PR.

thank you @solnic. I've kick-started a project that heavily relies on virtus, codebase is strong and well-tested, and there are many features I thought of. I'm currently combining at least 3 databases into a single data repository for some things we use in production, after trying to approach it in a active-record manner.

Maybe that work could also help out in future to make veritas to work with mongodb. Although I'm not yet ready to start writing a complete veritas-mongo-generator yet, but I think it may be an option a bit later, when some more general things are settled.

Collaborator

dkubb commented Apr 18, 2012

@ifesdjeen if you ever have any questions or need a hand with an veritas-mongo-adapter (or other related gems) please let me know. I think there are a few other people who may be interested, so it's not something you'd have to attempt solo. Plus of course, I'd give you whatever help I could too.

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