title: Ember data and metadata - accessing from controller
body: <p>I'm trying to access metadata using Ember Data, using ActiveModelAdapter. If the controller is set up in the router with model:</p>
  
  <pre><code>App.ClaimsIndexRoute = Ember.Route.extend
    authRedirectable: true
    model: -&gt;
      @store.findAll 'claim'
  </code></pre>
  
  <p>And the controller as a meta method as follows:</p>
  
  <pre><code>App.ClaimsIndexController = Ember.ArrayController.extend
    meta: (-&gt;
      @store.metadataFor('claim')
    ).property()
  </code></pre>
  
  <p>Then I can access the metadata in the index template:</p>
  
  <pre><code>{{meta.page}} {{meta.per_page}} {{meta.total_pages}}
  </code></pre>
  
  <p>But I needed to add filtering. So I changed the router to use <code>setupController</code>:</p>
  
  <pre><code>App.ClaimsIndexRoute = Ember.Route.extend
    setupController: (controller, model) -&gt;
      controller.loadClaims()
  </code></pre>
  
  <p>And in the controller added the loadClaim function:</p>
  
  <pre><code>App.ClaimsIndexController = Ember.ArrayController.extend
    loadClaims: -&gt;
      _filter = @get 'filter'
      _result = @store.find 'claim', {filter: _filter}
      @set 'model', _result
    filter: ''
    meta: (-&gt;
      @store.metadataFor('claim')
    ).property()
    actions:
      filterClaims: -&gt;
        @loadClaims()
  </code></pre>
  
  <p>Now the metadata is no longer available. I've entered the context using a debugger and can't seem to get anything. </p>
  
  <p>Is there a problem with sending a query to Ember Data? Is there a better way to do this?</p>
  
  <p>Incidentally, the metadata is sent by the server as <a href="http://emberjs.com/guides/models/handling-metadata/" rel="nofollow">suggested in the docs.</a></p>
  
  <p>I'm using Ember 1.6.1 and Ember data 1.0.0-beta.8.2a68c63a</p>