Using ember_data instead of ember_model.js

If ember_model.js included the following code works fine: (btw Ember Model : 0.0.11 isnt part of ember.js? why do i have to include in an MVC framework the model in a separeted js file? )

App = Ember.Application.create();

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

App.User = Ember.Model.extend({
    username: Ember.attr()
});

App.User.adapter = Ember.RESTAdapter.create();
App.User.url = "/sf2/web/app_dev.php/api/users";
App.User.collectionKey = "users";

now i want to use ember_data.js (DEBUG: Ember Data : 1.0.0-beta.7.f87cba88). There is no error in the console, but as i see the networking, there is no call to the api, and the page stays blank.

App = Ember.Application.create();

App.Store = DS.Store.extend({
    adapter: DS.RESTAdapter.create({
        url: '/sf2/web/app_dev.php/api'
    })
});

App.User = DS.Model.extend({
    username: DS.attr('string')

});


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

Answers


Ember can be used without Ember Model and Ember Data. Ember Model and Ember Data are data persistence libraries that can be used with Ember. Ember Model was created by Erik Bryn, and not under active development. Ember Data was created by the Ember core team and is under active development.

You're essentially using Ember Data incorrectly in your second example. You should read this transition document. https://github.com/emberjs/data/blob/master/TRANSITION.md Additionally here's a small example using Ember Data.

The main concept for Ember Data is defining an adapter, a model, then using the store to find records.

Adapter
App.ApplicationAdapter = DS.RESTAdapter;
Model
App.User = DS.Model.extend({
  firstName: DS.attr()
});
Store
this.get('store').find('user');

http://emberjs.jsbin.com/OxIDiVU/269/edit


Need Your Help

Android: TextView not updating on invalidate() or postInvalidate()

android android-intent

I'm fairly new to programming for android and I'm having trouble updating a TextView in my code. I am able to set it and it updates properly from onResume().

Position elements on a form using CSS

css forms alignment

I need to align labels and inputs of my form using CSS. The result should be something like this (I hope this simple scheme is clear):