Share your debugging tips and tricks


#1

As developers we tend to find neat and easy ways to help us developing applications, especially on a project that takes a long time and you basically need to do the same things over and over again.

Do you have any interesting tips/tricks that you use to help developing ember apps? If so, share them! Here are three functions that I use basically nonstop

// lookup content for the current route
window.a = function() {
  return d().get("content");
};

// lookup controller for the current route
window.d = function() {
  var path = c("application").get("currentPath");

  if (path.indexOf("index") === -1) {
    return c(path.split(".").slice(-1).join("."));
  } else {
    return c(path.split(".").slice(-2).join("."));
  }
};

// lookup controller by name
window.c = function(name) {
  return App.__container__.lookup("controller:" + name);
};

The names don’t have any meaning, besides the c as controller, the rest is just conveniently close.


#2

I’ve been using most of the tricks from the Debugging Ember.js and Ember Data article.


#3

I am using Ember.inspect function heavily in my console.log or console.debug to print ember objects especially controller or models