Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have you considered returning the user's name from the server directly. So that the url "/feeds", would return:</p> <pre><code>[ {message: "something one", creator_id: 100, name: "jhon"}, {message: "something two", creator_id: 101, name: "herry"}, ] </code></pre> <p>In case you just want the user's name to show near the message this seems a simple solution. I don't know what's your server's backend, but I'm sure this can be done efficiently.</p> <p>So answering you're questions:</p> <blockquote> <p>1) possible to use Backbone relation to handle this situation?</p> </blockquote> <p>Probably you could use the plugin to solve this situation, but I wold not recommend introducing a plugin to solve this specific example. To me seems inefficient to query the server for user models, just to display their name. However in different situations this might be appropriate.</p> <p>Anyway in case you decide to load user models with plugin or without it. You have to ask some questions to figure out if its worth it:</p> <ol> <li>How many queries will this generate? One per each user might be too much.</li> <li>How many user models will the server return in case you load all with one request? All users might be to much. So you need to load only needed ones.</li> <li>How much data will the server return? Do you really need all users's attributes?</li> </ol> <p>So in conclusion I would still argue you return the users's name directly from the server and load a specific user model only when you need more than it's name.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload