Skip to content

FetchLinks demo can't work #75

Description

@julianlecalvez

Hello,

I'm trying to have this example working on my project :
https://prismic.io/docs/ruby/query-the-api/fetch-linked-document-fields

I have 2 custom types : "etude" and "auteur"

  • "etude" has a linkedDocument to "auteur" named "auteur"
  • "auteur" has several properties but I'm trying at least to get "nom" (StructuredText)

So when I try to get the study, it works :
study = Prismic.api('https://****.prismic.io/api').query(Prismic::Predicates.at('document.type', 'etude')}).results[0]

Then I added the fetchlink :
study = Prismic.api('https://****.prismic.io/api').query(Prismic::Predicates.at('document.type', 'etude'), {'fetchLinks' => 'auteur.nom'}).results[0]
I got an error pointing this line : undefined method "call' for nil:NilClass"

I tried to simply put "auteur" or "etude.auteur" and the error disapeared, but I'm unable to get the linked "auteur" as a top-level document. I tried those syntaxes, I always get an empty array or null :

  • author = study["etude.auteur-link"] --> null
  • author = study["etude.auteur"] --> []
  • author = study["auteur.nom"] --> null

I can't have it work. Do you have any idea ?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions