title: How to pass an object to Ember.Handlebars.helper
body: <p>I'm trying to find out how to pass an Ember object through Handlebars to a helper function. Any ideas of how to do this?</p>
  
  <p>Data</p>
  
  <pre><code>groups = [
    {
      id:'as93-2dsa',
      name:'read'
    },
    {
      id:'dk20-d23k',
      name: 'write'
    },
    {
      id: 'mn20-8al3',
      name: 'execute'
    }
  ];
  user = {
    id:'lk30-a8bk',
    name: 'Seth'
    groupIDs:[
      'as93-2dsa',
      'lk30-a8bk'
    ]
  }
  </code></pre>
  
  <p>HTML</p>
  
  <pre><code>{{inGroup groups user}}
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>Ember.Handlebars.helper('inGroup', function(groups, user) {
  
  /** 
   * At this point I would expect groups to be and object and user to be an object
   * but both return classes
   */
  
    console.log(groups); 
    //Class {toString: function, __ember1418251045900: "ember646", __nextSuper: undefined, __ember_meta__: Object, constructor: function…}
    console.log(groups.toString()); 
    // "&lt;DS.PromiseArray:ember646&gt;"
  
    console.log(user); 
    //Class {id: "5CF3A051-12B4-436C-B43A-5696F2792B55", store: Class, container: Container, _changesToSync: Object, _deferredTriggers: Array[0]…}
    console.log(user.toString()); 
    // "&lt;nfors-app@model:user::ember526:5CF3A051-12B4-436C-B43A-5696F2792B55&gt;"
  
  /**
   * I would like to access groups[i].id and user.groupIds in a way such as the following
   */
  
    for (var i = 0; i &lt; groups.length; i++) {
      if (user.groupIds.indexof(groups[i].id) !== -1) {
        return true;
      }
    }
    return false;
  });
  </code></pre>
  
  <p>User Model</p>
  
  <pre><code>import DS from 'ember-data';
  import EmberValidations from 'ember-validations';
  
  export default DS.Model.extend(EmberValidations.Mixin, {
      name:       DS.attr('string'),
      groupIds:    DS.hasMany('groupIds', { async: true }),
  
      validations: {
          name: {
              presence: true,
              length: { minimum: 5 }
          }
      }
  });
  </code></pre>