Answers.Body: <p>Just checked eager-loading a text field in a template and by eager-loading it you are actually converting the field to an array and therefore unable to template it as usual. Eager-loading is generally only useful on fields like categories, assets, and matrixes.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T20:01:00.453Z
Answers.Text: Thanks! You are right. Removing the text fields worked. Eager loading the categories (and one asset field I will be adding) should help. :)
Answers.UserDisplayName: Angela
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-08T00:13:06.757Z
Answers.Text: Don't forget to eager load the transforms as well if your asset field is using image transforms!
Answers.UserDisplayName: Patrick Harrington
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-07T19:54:13.637Z
Answers.LastActivityDate: 2016-04-07T20:12:03.363Z
Answers.LastEditDate: 2016-04-07T20:12:03.363Z
Answers.UserDisplayName: mcclaskiem
Body: <p>I am trying to eager load users in a specific group to reduce queries. I've tried this:</p>
  
  <pre><code>                {% set designers = craft.users({
                      group: 'designers',
                      with: [
                              'userAgencyName',
                              'userAgencyUrl',
                              'userFreelancerAgency',
                              'userDescriptionServices',
                              'userBudget',
                              'userCity',
                              'userStateProvince'
                              ]
                  }) %}
  </code></pre>
  
  <p>This consists of 5 user text fields and 2 user category fields. Although it's returning the array to string conversion error. </p>
  
  <p>The loop is setup like this:</p>
  
  <pre><code>    {% paginate designers.limit(7) as designers %}
  
      {# Loop through Designers #}
      {% for designer in designers %} 
  
      &lt;div class="listing-box"&gt;
          &lt;h1&gt;&lt;a href="/designers/{{ designer.username }}"&gt;{{ designer.userAgencyName }}&lt;/a&gt;&lt;/h1&gt;
  
          &lt;div class="listing-links"&gt;
              &lt;ul&gt;
                  &lt;li&gt;
                  {% for category in designer.userFreelancerAgency %}
                  &lt;a href="{{ category.url }}"&gt; {{ category }}&lt;/a&gt;
                  {% endfor %}    
                  &lt;/li&gt;
                  {% for category in designer.userBudget %}
                  {% if category %}
                  &lt;li&gt;                    
                  Budgets: &lt;a href="{{ category.url }}"&gt;{{ category }}&lt;/a&gt;                    
                  &lt;/li&gt;
                  {% endif %}
                  {% endfor %}
                  {% if designer.userCity | length %}     
                  &lt;li&gt;{{ designer.userCity }}, {{ designer.userStateProvince }}&lt;/li&gt;
                  {% endif %}
              &lt;/ul&gt;
          &lt;/div&gt;  
          &lt;p&gt;{% if designer.userDescriptionServices %}{{ designer.userDescriptionServices }}{% endif %} 
  
      &lt;/div&gt;
      &lt;!--End listing-box--&gt;  
     {% endfor %} 
  </code></pre>
  
  <p>Thanks in advance for any help you can give!    </p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-07T19:47:26.803Z
Comments.Text: I think this may be because you are eager-loading text fields, try to remove them from your `with` and then reload template.
Comments.UserDisplayName: mcclaskiem
Tags: <users><user-groups><eager-loading>
Title: Eager Loading Users Returning "Array to String Conversion" Error
ThreadText: # Eager Loading Users Returning "Array to String Conversion" Error
  
  (Asked by: username_0 on 2016-04-07)
  
  I am trying to eager load users in a specific group to reduce queries. I've tried this:
  
  ```
                  {% set designers = craft.users({
                      group: 'designers',
                      with: [
                              'userAgencyName',
                              'userAgencyUrl',
                              'userFreelancerAgency',
                              'userDescriptionServices',
                              'userBudget',
                              'userCity',
                              'userStateProvince'
                              ]
                  }) %}
  
  ```
  
  This consists of 5 user text fields and 2 user category fields. Although it's returning the array to string conversion error.
  
  The loop is setup like this:
  
  ```
      {% paginate designers.limit(7) as designers %}
  
      {# Loop through Designers #}
      {% for designer in designers %} 
  
      <div class="listing-box">
          <h1><a href="/designers/{{ designer.username }}">{{ designer.userAgencyName }}</a></h1>
  
          <div class="listing-links">
              <ul>
                  <li>
                  {% for category in designer.userFreelancerAgency %}
                  <a href="{{ category.url }}"> {{ category }}</a>
                  {% endfor %}    
                  </li>
                  {% for category in designer.userBudget %}
                  {% if category %}
                  <li>                    
                  Budgets: <a href="{{ category.url }}">{{ category }}</a>                    
                  </li>
                  {% endif %}
                  {% endfor %}
                  {% if designer.userCity | length %}     
                  <li>{{ designer.userCity }}, {{ designer.userStateProvince }}</li>
                  {% endif %}
              </ul>
          </div>  
          <p>{% if designer.userDescriptionServices %}{{ designer.userDescriptionServices }}{% endif %} 
  
      </div>
      <!--End listing-box-->  
     {% endfor %} 
  
  ```
  
  Thanks in advance for any help you can give!
  
  **Tags:** users, user-groups, eager-loading
  
  > **Comments:**
  > **username_1**: I think this may be because you are eager-loading text fields, try to remove them from your `with` and then reload template.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-04-07. Score: 5 | Accepted answer
  
  Just checked eager-loading a text field in a template and by eager-loading it you are actually converting the field to an array and therefore unable to template it as usual. Eager-loading is generally only useful on fields like categories, assets, and matrixes.
  
  > **Comments:**
  > **username_0**: Thanks! You are right. Removing the text fields worked. Eager loading the categories (and one asset field I will be adding) should help. :)  
  > **username_2**: Don't forget to eager load the transforms as well if your asset field is using image transforms!  
  
  ---
  
  