Contentful logo

Contentful Community

Select operator for multiple fields? (Ruby)

Hi there, my question relates to the select operator amd the contentful_model gem.

In order to use the select operator, I can use the CM params hash, e.g. Contentful::Page.params(select: 'fields.titles').
However, how can I select multiple fields? I’ve tried every syntax variation I can think of, but without success. The main Contentful docs don’t have an example of multiple fields that I can work from either.

Bonus question - does anyone know how the select operator can be combined with retrieving an entry by ID?
e.g. (non working), Contentful::Page.find('uniqueID').params(select: 'fields.titles').load
Again, I’ve tried a bunch of variations here.


Hi @katherine,

The API itself does allow you to select up to 100 properties, as explain in our documentation:

Also, it would be possible for you to combine this operator with a specific entry by using the operator directly in your entries endpoint query.