Lead character without API call

I am trying to set up a REST model and have a problem that completely hurts me: the generated API call seems to delete the first letter of the model and therefore cannot get the data (error 404 appears).

I start by creating a repository:

App.Store = DS.Store.extend({ revision: 11, adapter: DS.RESTAdapter.reopen({ namespace: 'api/admin' }) }); 

Then I install the model (called "dbx_tables" in the REST service:

 App.dbxTable = DS.Model.extend({ name: "string", db_column: "string" }); 

Then there is a route:

 App.DbxRoute = Ember.Route.extend({ model: function() { return App.dbxTable.find(); } }); 

I turned on conversion logging:

 App = Ember.Application.create({ LOG_TRANSITIONS: true }); 

So when I launch the application, it goes to the "about" page first and then to the "dbx" view (I'm not sure why it says dbx.index and not just dbx ):

 DEBUG: ------------------------------- ember-1.0.0-rc.1.js:339 DEBUG: Ember.VERSION : 1.0.0-rc.1 ember-1.0.0-rc.1.js:339 DEBUG: Handlebars.VERSION : 1.0.0-rc.3 ember-1.0.0-rc.1.js:339 DEBUG: jQuery.VERSION : 1.9.1 ember-1.0.0-rc.1.js:339 DEBUG: ------------------------------- ember-1.0.0-rc.1.js:339 Transitioned into 'about' ember-1.0.0-rc.1.js:339 Transitioned into 'dbx.index' ember-1.0.0-rc.1.js:339 GET http://lifegadget-local/api/admin/bx_tables 404 (Not Found) jquery-1.9.1.js:8526 

note the link to bx_tables in the API call. How to remove the leading "d"? I was also not sure why it pluralizes the call, although it can easily fit into the convention, so it really doesn’t care.

+4
source share
2 answers

Well, it looks like I made a “mistake of agreement”, and the problem of lack of capitalization in the model was the cause of the problems. Therefore, by switching App.dbxTable to App.dbxTable , I now App.dbxTable problem.

+1
source

I had the same problem. My problem:

 this.get('store').findAll('user'); 

must be changed to:

 this.get('store').findAll('user'); 
+6
source

All Articles