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

Prevent circular references (for comment/feedback) #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DougPuchalski
Copy link

Submitted for comments, feedback for general usefulness.

For my app I had issues serializing resources that link to each other. This would cause infinite recursion.

This PR leverages the context to block resources have already been serialized.

@DougPuchalski
Copy link
Author

Assuming this goes a bit further than #49

@DougPuchalski
Copy link
Author

I also have a follow-on for this PR which adds support for inherited schema blocks.

Blocked by tracking already-serialized resources in context
@DougPuchalski DougPuchalski force-pushed the feature/block-circular-refs branch from 26ab1d4 to 4aaac73 Compare January 12, 2015 19:10
return if collection.nil? || collection.empty?
context_options ||= {}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the content_options argument default value is nil, this line will always resolve to {}. So keeping the default value as {} means this line is not necessary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default only takes effect when the arg is not supplied. The intention is for context_options to be {} even if the argument is passed in explicitly as nil.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense. Thanks for clarifying.

@sandstrom
Copy link

Friendly ping ⛵ What steps are required to move this forward?

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.

3 participants