I have an ArrayController as follows:
DashboardController = Ember.ArrayController.extend
content: []
xFormatter: (x) ->
d3.time.format("%m-%d") x
init: ->
console.log("dashboardController init")
@_super()
y = undefined
currentDate = undefined
i = 1
while i < 30
currentDate = new Date("12/" + i + "/2011")
@content.pushObject
x: currentDate
y: (Math.random() * 100) / 10
i++
When the app initializes, the controller is created (as indicated in the console) and content is pushed into the array during init, but content is undefined when I try to access it from elsewhere (e.g. a view). I tried content: null, then doing @set("content", []) at the start of init but got the same result.
The Ember guides say to set an ArrayController's content property in my route's setupController method to tell it what model to represent, but since this "model" is a really the result of a function, I'm not sure how to go about that. I thought that since init is run for each created instances, each instance would get a populated content without using setupController.
I think the example I pulled this from is using a old approach not suitable for 1.0.0-rc1. How should I restructure this to work?