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


#1

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)


#2

You can do this in the console:

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

#3

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


#4

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?


#5

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


#6

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:


#7