2

I am very new to EmberJS. I am trying to make a simple Ember CRUD app. I am using Ember Data 's REST adapter. The REST adapter is configured to pull data from a CodeIgniter application.

I have tested the CodeIgniter application and it is serving data correctly.

Here is my Ember code (except the routes)

http://pastebin.com/pWrp6hRz

Here is my router.js file

http://pastebin.com/MzqAjshJ

When I navigate to /users, I get this error:

Error: assertion failed: Error while loading route:
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /users was not found on this server.</p>
</body></html>
, status: 404, statusText: Not Found} @ http://localhost/todo3/js/libs/ember-1.2.0.js:796

A similar error is encountered when I navigate to /departments

Interestingly, if I change the line

App.ApplicationAdapter = DS.RESTAdapter.extend();

to

App.ApplicationAdapter = DS.FixtureAdapter.extend();

and comment out

DS.RESTAdapter.reopen({
  url: 'http://localhost/service_r/index.php'
});

and also add some FIXTURE data...(making absolutely no more changes) then the error dissappears and I can see the data.

What is the problem with RestAdapter?

2
  • 4
    I am not familiar with the "url" property on RESTAdapter. What does that do? Shouldn't you be using the "namespace" or "host" properties? You can read about the RESTAdapter here: emberjs.com/api/data/classes/DS.RESTAdapter.html Commented Dec 2, 2013 at 23:59
  • My mistake. I swapped 'url' for 'host' and then I could get data. Please post your comment as an answer so that I can mark it. Commented Dec 3, 2013 at 0:46

2 Answers 2

3

I guess I should have posted this as an answer :) Thanks for the vote!

I am not familiar with the "url" property on RESTAdapter. What does that do? Shouldn't you be using the "namespace" or "host" properties? You can read about the RESTAdapter here: emberjs.com/api/data/classes/DS.RESTAdapter.html

Sign up to request clarification or add additional context in comments.

Comments

1

It seems to be a problem on your server as you are getting a 404. Just exactly as the error message shows. You should use the 'namespace' property to ensure you are reaching the correct serverurl.

Edit: Steve H already posted this answer in a comment!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.