Skip to content

Models "steal" each others collections #126

Closed
@Sephi-Chan

Description

I develop an app where users have vehicles (with a HasMany relationship).
On the user profile page, I display the profile of the given user and I list his vehicles.
But on the sidebar, I also list the vehicles of the current user.

The problem occurs when the user displays his own profile page, the collection of vehicles is only in one object (the last instantiated). Example:

currentUser = Store.get('currentUser')
console.log currentUser.get('vehicles').length // 4

user = new Models.User(Seeds.user)
console.log user.get('vehicles').length // 4
console.log currentUser.get('vehicles').length // 0

The result for me is that the vehicles are in the page content but not in the sidebar anymore.
How can I fix that?

Note that I have to instantiate this second user since its attributes are not the exactly the same as the current user object (some private attributes are not in the "public" version of the user).

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions