-
Notifications
You must be signed in to change notification settings - Fork 42
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
stack too deep issue updating a model with a linked field #76
Comments
Hey @niedfelj, This is a known issue with the 0.x and 1.x versions of the CDA SDK. I'm working on the 1.0 release of this gem which uses the 2.x version of the CDA SDK, which has this fixed and is configurable for how deep you want nesting resolutions. I don't have an ETA for when this will be finally released, but most likely within the next 2 months. In the meantime, feel free to use Cheers |
Hi David, Are you sure this is the same issue? I don't really have cyclical relationships in my data, so it feels like it's something else? |
Oh, I understood the issue incorrectly then. Can you please let me know if you add the code indicated here in an initializer if the issue is fixed? module Contentful
class Entry
alias_method :to_json, :raw_with_links
end
end Please let me know if that solves your issue, so that I can update this gem accordingly. Cheers |
On first try, that doesn't seem to resolve the issue either. I will see if I can get a 2.x version of CDA working later today and let you know? |
Did you have a chance to look at my demo of the bug? |
Hey @niedfelj, I haven't had the time today yet. But either tomorrow or Monday, I'll definitely take a look into it. I pointed you towards that issue on the CMA SDK, because I had at least something similar happen (by the looks of my issue description and yours) and that was the way I got it solved. As soon as I find a way to solve it, I'll let you know. Cheers |
Hey @niedfelj, Found what I think the issue is. It looks like the This ends up making setting the I found it possible to go through this issue by using the internal mgmt_article = article.to_management
mgmt_article.section = {sys: {id: section.id, type: 'Link', linkType: 'Entry'}}
mgmt_article.save
mgmt_article.publish
article = Contentful::Article.find(mgmt_article.id)
article.section
# => <Contentful::Section[section] id='6KSRtnjHfGueIIuE2aiWco'> I'll add this as a bug in our backlog, I'm currently working on finalizing a release for the CMA SDK, as soon as I'm done with that, I'll be back on working on the new release of this gem, which will have a fix for this bug included. On the meantime, I please ask you to use this workaround on Cheers |
I'm running into a strange issue where saving an object with a linked field is generating a stack too deep issue. I've created a demo app here that you can use to test/debug:
https://github.com/niedfelj/contentful_model_bug
It seems to get stuck in the as_json call of a model class, recursively calling as_json on the class over and over because when it calls instance_values on a class, another reference to the class is returned which then also has as_json called on it which of course returns the same hash of instance_values
The text was updated successfully, but these errors were encountered: