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

  • SEARCH
  • Home
  • 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 7701819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:05:06+00:00 2026-05-31T23:05:06+00:00

I have a parent model that has many child models, for example: App.Blog =

  • 0

I have a parent model that has many child models, for example:

App.Blog = Ember.Object.extend({})
App.Comment = Ember.Object.extend({})

Then I have a view for the Blog:

window.App.BlogView = Ember.View.extend
  templateName: 'app_templates_blog'

Now, when I initially retrieve a Blog via my REST API, it contains the first 10 Comments or so. Those are instantiated like this:

window.App.Blog.reopenClass
  create: (obj) ->
    Object.tap @_super(obj), (result) =>
      if result.comments
        result.comments = result.comments.map (p) => App.Comment.create(p)

I display by blog by calling BlogView.set(‘blog’, blogInstance) and everything is displaying perfectly.

However!

I am implementing an infinite scroll, so when the end user gets to the bottom of the comments, I want to load more. I do this via REST, but I can’t for the life of me get them to display by appending them.

This is what my morePosts() method looks like in BlogView:

moreComments: () ->
  blog = @get('blog')

  jQuery.getJSON "/blogs/#{blog.get('id')}/comments", (result) =>        
    comments = blog.get('comments')
    result.each (c) => comments.push(App.Comment.create(c))
    blog.set('comments', comments)
    this.set('blog', blog)    

However, this never seems to add the new comments. What am I doing wrong here?

  • 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-05-31T23:05:08+00:00Added an answer on May 31, 2026 at 11:05 pm

    To properly support Ember’s bindings and observers, you need to use KVO aware getters and setters. Just as you use get and set for standard properties, you also have to use special methods for Arrays. In this case, you’d use pushObject. You can see a full list of the functions implemented here: https://github.com/emberjs/ember.js/blob/master/packages/ember-runtime/lib/mixins/mutable_array.js.

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

Sidebar

Related Questions

I have a parent object which has a one to many relationship with an
I have a parent project that is branched to many dependent child projects. I
I have two linqTOsql entities that has a parent and child relationship, one to
i have a Parent class that has two child collections ChildCollectionA and ChildCollectionB. ChildCollectionA
I have a Model with a Foreign Key of Parent class Item(models.Model): parent =
I have a parent class which contains a child object. I am using set
I have a complex form for a model Schedule that belongs to a parent
Let's say I have an ActiveRecord model called Book that has a has_many association
Suppose I have a model Person which has a one to many relationship with
Given a table of models 'A', that can have multiple child models 'B', of

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.