Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9146523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:46:15+00:00 2026-06-17T10:46:15+00:00

Using ember data, I’ve run across an issue during serialization where computed properties are

  • 0

Using ember data, I’ve run across an issue during serialization where computed properties are not included in the payload.

var Person = DS.Model.extend({
    firstName: DS.attr('string'),
    lastName:  DS.attr('string'),
    fullName:  function( ) {
            return this.firstName + this.lastName;
    }.property()
});

App.store.createRecord( Person, {
    firstName: 'John',
    lastName:  'Doe'
});
App.store.commit();

Results in the following payload:

{ firstName: "John",
  lastName:  "Doe" }

I’ve tried adding .cacheable() to the property, but it didn’t seem to help. I’ve also tried wrapping the entire fullName function in Ember.computed(), but that didn’t seem to help, either.

Tracing the Ember code, I see that the data for the request comes from DS.Model.serialize() which collects all the attributes for the model. However, it does not seem to collect computed properties.

Ember Code Snippet:

serialize: function(record, options) {
  options = options || {};

  var serialized = this.createSerializedForm(), id;

  if (options.includeId) {
    if (id = get(record, 'id')) {
      this._addId(serialized, record.constructor, id);
    }
  }

  this.addAttributes(serialized, record);
  this.addRelationships(serialized, record);

  return serialized;
},

addAttributes: function(data, record) {
  record.eachAttribute(function(name, attribute) {
    this._addAttribute(data, record, name, attribute.type);
  }, this);
}

As you can see, they collect attributes and relationships, but there doesn’t seem to be anything collecting computed properties. My strategy at first was to overload addAttributes() to also loop through all computed properties and add them to the list. But in my attempt, couldn’t figure out a reliable way to get a list of computed properties. If I made the properties cacheable, I could use Ember.meta( model, 'cache' ) but that list includes all attributes, computed properties, and a few extras that I don’t need/want.

So, my questions after all of this…

  • Is there a way in Ember that already exists to cause computed properties to be included in the serialization?

  • If not, I can overload appropriate methods, but how do I get a dynamic list of all computed properties? (I can use .getProperties() but it expects an array of property names, which I don’t have)

  • Any other relevant suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:46:16+00:00Added an answer on June 17, 2026 at 10:46 am

    I have not tried it, but does eachComputedProperty suit your purposes?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Ember 0.9.8.1 and having an issue with nested views not retaining the
Using the last version of ember-js and ember-data, I got an issue when deleting
I'm building a table cell using two bound ember.js views on data. When I
I'm using Ember built from git master. My RouteManager is not complex, but when
I'm using http://cloud.github.com/downloads/emberjs/ember.js/ember-0.9.5.js and I'm not sure how to use the mouseenter and mouseleave
Using: Ember commit a5d45f66e1 from Jan 3, 2013) Ember-Data commit 508479dee7 from Jan 4,
I am building a project management app using ember.js-pre3 ember-data revision 11. How do
I'm using the new router and ember data rev 11. I have a need
I'm using Ember Data to define two models and an association between the two,
I am have difficulty setting a belongsTo relationship using ember data. I have a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.