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

If a field is nil for a specific locale, Entry gets into a corrupted state #98

Closed
dlitvakb opened this issue Jul 28, 2016 · 0 comments
Closed
Assignees
Labels

Comments

@dlitvakb
Copy link
Contributor

To fix, make sure that Entry#fields always at least returns an empty hash.

[32] pry(main)> client.entries('sys.id' => 'no-ne-NP', locale: 'ne-NP')
=> #<Contentful::Array:0x3ff3558c2610>
[33] pry(main)> client.entries('sys.id' => 'no-ne-NP', locale: 'ne-NP').first
=> #<Contentful::DynamicEntry[sampleType]:0x3ff35729dabc>
[34] pry(main)> client.entries('sys.id' => 'no-ne-NP', locale: 'ne-NP').first.fields
=> nil
[35] pry(main)> client.entries('sys.id' => 'no-ne-NP', locale: 'ne-NP').first.instance_variable_get(:@fields)
=> {}
[36] pry(main)> client.entries('sys.id' => 'no-ne-NP', locale: 'ne-NP').first.title
NoMethodError: undefined method `[]' for nil:NilClass
from /Users/davemac/dev/contentful/api_clients/ruby/delivery.rb/lib/contentful/dynamic_entry.rb:36:in `block (3 levels) in create'
[37] pry(main)> client.entries('sys.id' => 'no-ne-NP', locale: 'ne-NP').first.respond_to?(:title)
=> true
@dlitvakb dlitvakb added the bug label Jul 28, 2016
@dlitvakb dlitvakb self-assigned this Jul 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant