Loading partial model, and updating model in the future

Hi all:

Assume we have a simple blog app written in Ember.

The PostsIndex route only expects partial post objects. Say the title and a preview. Once the user transitions to the the PostsShow route it will expects the full model be send down the wire via json, as well as all the relationships. (A post has many comments, and a post has many editors)

How should I approach this problem? I know I can call reload on the post model but what if the comment and editor model for the post object in question were also partial loaded. How do I do a full refresh and retrieve the complete model and relationship models.

Thanks

Have you considered having 2 different types of model? Maybe a PostPreview and a Post? It might be a bit trickier to work with, but it’s probably the cleanest way to deal with just part of a particular model.

I’ve used two (Rails/ActiveModel::Serializer) serializer classes on the server side, one used with a controller index action and another serializer used on the show action. The incomplete representation of the model served on the GET index will need to be reloaded when a single complete representation of the data is fetched.