I know I'm just missing something simple here but the following does not seem to work.
App.Storage = Ember.Object.extend
push: (key, data)-> #I want to call this from the loop below in pushMany
#...
#...
pushMany: (key, data)->
data.forEach (d)->
#Tried:
@push(key, d) #<< TypeError: undefined is not a function
#Also tried:
@send('push', key, d) #<< TypeError: undefined is not a function
#Also tried:
App.Storage.push(key, d) #<< TypeError: undefined is not a function
I am calling the pushMany in a route:
App.MessagesRoute = Ember.Route.extend
setupController: (controller, model)->
#storage is injected to route
#I can call storage.push here so I'm pretty sure my injection is working properly
storage = @get('storage')
storage.pushMany 'message', [{id: 3, value: 'Test Msg', author: 'Jules'}, {id: 4, value: 'Hello World!', author: 'Jules'}]
Been stuck for hours now. Any help would be appreciated.