Q:

How do I debug model objects in Ember?

I am trying to get a collection of objects from a json url.
  model: ->
    url = 'http://localhost:3003/api/tasks'
    Ember.$.getJSON(url).then (data) ->
        data

How do I debug the data so I can see the value of certain areas? I tried splice but it complains that method doesn't exist. I tried data[0] and other things and nothing shows up. How do you debug that object to see what it grabbed from the URL?

A:

In modern browsers you can use console.log:
model: ->
    url = 'http://localhost:3003/api/tasks'
    console.log('Sending ajax request')
    Ember.$.getJSON(url).then (data) ->
        console.log('Received ajax request with', data)

You can either use the debugger keyword, to create a breakpoint. And inspect the objects with the dev tools of your browser.

