With the new router API, how do I get to a controller for debugging purposes?

I was wanting to check .content on controller today in console. In the old days I would do:

Discourse.router.fooController.content

This has been stripped, what other options do I have (for diagnostics)

You can do this in the console:

Discourse.__container__.lookup('controller:foo')
3 Likes

and this completely private. I think Yehuda is working on a debugging object.

2 Likes

In the peepcode video screencast they use verbiage like this:

App.Table.find().objectAt(3).get('tab).get('tabItems').objectAt(2).get('cents')

Find a table, get the tab for that table, and the tabItem at 2 in the index, then get it’s cents property. You might be able to use a similar approach to get the content?

although private, it is exposed for all your debugging needs.

Yep, although it may be removed in the future and isn’t considered part of the stable API.

I think something like: debug.controller('posts') would be pretty nice :smiley:

1 Like