I was curious what people’s opinions on this are. I’m sure this will rile someone up on the Core team, but making the jump from Ember tutorials, guides, and stand alone applications to real-world applications has proven to be enormous.
I’ve been studying Ember for the last few months and am pretty confident when building stand alone ember apps or small apps built with ember data. But my full time job is building the front end of a complex application. The app is divided into three rails apps: a device manager, an api, and the front end. And it has taken much longer than expected to get the kinks worked out.
For example, in all the tutorials I ever did I created a model (group), some nested routes (groups → group), a groups route, and an application, groups, and group template. What I liked so much about ember is with these few files I could load a list of objects on the page and have the ability to select an individual object and display it on the same page, and then use the back and forward buttons to load the data without reloading the page. Ember did all this by creating a group route, controller, view, etc. on the fly.
But with the current app I’m building where I’m pulling data in from an api, I’ve had to explicitly create a group route and a find() method on the model to reload the js objects when the url changes. And even then, the page often jumps or flickers when I hit the back button and it rerenders the id.
Here’s my group model that I had to create to properly retrieve data:
App.Group = Ember.Object.extend()
App.Group.reopenClass
all: ->
App.ajax(
url: App.apiUrl('groups')
).then (data) ->
console.log data
groups = []
for group in data.response
groups.addObject(App.Group.create(group))
console.log(groups)
groups
find: (group_id) ->
App.ajax(
url: App.apiUrl("/groups/#{group_id}")
).then (data) ->
return App.Group.create(data.response)
I hope I’m doing something wrong and someone can correct me. But its been difficult transferring from fixture data to real data. Thoughts?