contentful_middleman icon indicating copy to clipboard operation
contentful_middleman copied to clipboard

Mapping an optional field

Open neetso opened this issue 4 years ago • 1 comments

Within a mapper, I'm trying to add some additional data derived from my contentful content. However, the field is not required and I get an error: "'empty_field_error': The field 'restrictions' is empty and unavailable in the response'."

In the mapper I tried something like: unless.entry.restrictions.nil? or if.entry.restrictions.present? but I still get the error above.

How can you deal with optional fields in the mapper?

neetso avatar Nov 18 '20 18:11 neetso

Hey @neetso,

I am looking into it. I will get back to you if I need more details.

Cheers

rubydog avatar Nov 19 '20 04:11 rubydog