Uses slices with repeatable content relationships

Hey everyone

I’ve been getting on really well with prismic using Rails up until now. I have a single team page and within that I have a slice with a repeatable zone with the “Content Relationship” type and this uses a “Person” type, which is a repeatable type. I can’t for the life of me get the individual people to show.

Here is my type config.

{
  "Main": {
    "uid": {
      "type": "UID",
      "config": {
        "label": "uid"
      }
    },
    "title": {
      "type": "StructuredText",
      "config": {
        "single": "heading1",
        "label": "Title"
      }
    },
    "body": {
      "type": "Slices",
      "fieldset": "Slice zone",
      "config": {
        "labels": {
          "people": [],
          "members": []
        },
        "choices": {
          "members": {
            "type": "Slice",
            "fieldset": "People",
            "description": "Staff members",
            "icon": "person",
            "display": "list",
            "non-repeat": {},
            "repeat": {
              "member": {
                "type": "Link",
                "config": {
                  "select": "document",
                  "customtypes": [
                    "person"
                  ],
                  "label": "Member"
                }
              }
            }
          }
        }
      }
    }
  }
}

In my controller I have:

@document = api.getSingle('page_team', { "fetchLinks" => "member.name" })

I also tried:

@document = api.getSingle('page_team', { "fetchLinks" => "person.name" })

In my view I have:

<h1><%= @document["page_team.title"].as_text() %></h1>

<% @document["page_team.body"].slices.each do |slice| %>
  <% if slice.slice_type == 'members' %>
    <% slice.repeat.each do |member| %>
      <%= member['name'].as_text() %>
    <% end %>
  <% end %>
<% end %>

I get the following undefined method as_text’ for nil:NilClass`.

Are there any examples out there of how to do this in Rails or if anyone can help I’d greatly appreciate it.

Best
Steve

Can you show your whole response from prismic? The @document["page_team.title"] and the @document["page_team.body"]?

This issue has been closed due to inactivity.