title: Ember.js ember-data restadapter fail to load json
body: <p>Cheers! 
  I have ember-data store:</p>
  
  <pre><code>TravelClient.Store = DS.Store.extend({
    revision: 11,
    adapter: DS.RESTAdapter.create({ bulkCommit: false, url: "http://someIP:somePORT"})
  });
  </code></pre>
  
  <p>And router:</p>
  
  <pre><code>TravelClient.ToursRoute = Ember.Route.extend({
    model: function() {
      return TravelClient.Tour.find();
    }
  });
  </code></pre>
  
  <p>I recieve this JSON from remote server:</p>
  
  <pre><code>{
    "tours": [
      {
        "id": "5110e8b5a8fefe71e0000197",
        "title": "qui deserunt dolores",
        "description": "Id velit nihil.",
        "seats": 12,
        "options": [
  
        ],
        "images": [
          {
            "id": "5110e8b5a8fefe71e0000196",
            "url": "url"
          }
  }
  </code></pre>
  
  <p>But when I try to <code>return TravelClient.Tour.find()</code> it fails with:</p>
  
  <pre><code>http://someIP:somePORT/tours 404 (Not Found)
  
  XMLHttpRequest cannot load http://someIP:somePORT/tours. Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
  </code></pre>
  
  <p>IT seems like RESTAdapter doesn't know, that it must receive JSON or what?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>In the application controller on the rails server-side:</p>
  
  <pre><code>def set_access_control_headers
    headers['Access-Control-Allow-Origin'] = '*'
    headers['Access-Control-Request-Method'] = '*'
  end
  </code></pre>
  
  <p>But it's still :</p>
  
  <pre><code>OPTIONS http://someIP:somePORT/tours 404 (Not Found)
  </code></pre>
  
  <p>And it looks like RESTAdapter tries to load tours resource, not tours.json:</p>
  
  <pre><code>Request URL:http://someIP:somePORT/tours
  </code></pre>
  
  <p><strong>WORKING SOLUTION</strong></p>
  
  <p>Extend RESTAdapter:</p>
  
  <pre><code>TravelClient.CUSTOMAdapter = DS.RESTAdapter.extend({
    bulkCommit: false, 
    url: "http://remote_server_address",    
    buildURL: function(record, suffix) {
      var s = this._super(record, suffix);
      return s + ".json";
    }
  })
  </code></pre>
  
  <p>and respond to an OPTIONS request with right headers</p>