I compile some handlebars during runtime and want to send JSON data in.
What I need is serialized computed properties of a model.
For example I have “quantity” and “price” properties and computed property “amount”.
Serialization gives me JSON with just “quantity” and “price”
Hi emberigniter, thank you for idea I will try it,
but I would actually like to avoid serialize method, so that I do not send unnecessary properties to server, ideas?
Additional question; how to list or loop through computed properties?
That’s the exact opposite: we use the serialize method to control exactly which properties we send to the server.
By the way, I think that snapshot only contains DS.attr attributes; in that case you can access the record itself by calling snapshot.record.get('computedProperty')
ok, I think I understand your usage of serialize, but I need one “serialize” to comunicate to api server (without computed properties, this works ok as it is) and other method like toJson (but with computed prop.) to feed runtime compiled template completely on client side.
I will try record.get('computedProperty') thnx, but is there a way to loop through all computed properties?