toStringExtension and DS.Model

I have just started looking at ember in order to use it for a rich client application with a rails backend. The two way data binding is very cool. I am slowly working out through ember-data.

In order to help with debugging, I was using the toStringExtension method in my model. Howver, it seems to me that the toStringExtension is caching the computed value of the function. I am not sure if this is the expected behavior or not.

Hmm, it doesn’t seem like this should be the case. It looks like the method should be called every time toString is called. It should be easy to verify by adding a console.log in your toStringExtension method.

Peter, Here’s some code. I have confirmed that console.log does not get called

Profile = DS.Model.extend
  firstName: DS.attr('string')
   toStringExtension: ->
     console.log 'extension called'
     "Profile for #{@get('name')}"

Profile.createRecord name: 'dennis'
p.toString()

log called profile.js?body=1:15

“Prospects.Profile:ember743:Profile for Dennis>”

p.set('name','ha')
p.toString()

“Prospects.Profile:ember743:Profile for Dennis”