I'm starting to use Ember.js with Rails 3.2.13 through the ember-rails gem. I am unable to access data through the browser console with the following command:
var posts = App.Post.find();
It returns undefined on the console, but the following is outputted on the server logs:
Started GET "/posts" for .......
Processing by PostsController#index as JSON
Parameters: {"posts"=>{}}
Post Load SELECT "posts".* FROM "posts"
Completed 200 OK .....
Please let me know if I am doing something wrong or missing something. Thanks
Here are the steps I took to install ember-rails
1) Add ember-rails to gem file
2) After my bundle install, I run:
rails g ember:bootstrap
There are the MVC directories, app.js, application.js, router.js, and store.js.
store.js has the following contents:
App.Store = DS.Store.extend({
revision: 11
});
3) Then I did
rails g scaffold Post title:string body:text
Next I added the active_model_serializer gem and generated a serializer for Post.