{"id":21367472,"url":"https://github.com/isleofcode/ember-changed-relationships","last_synced_at":"2025-07-13T05:31:37.736Z","repository":{"id":57223056,"uuid":"83226577","full_name":"isleofcode/ember-changed-relationships","owner":"isleofcode","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-11T18:58:02.000Z","size":17,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-02T12:16:52.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isleofcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-26T17:18:59.000Z","updated_at":"2020-09-15T13:35:51.000Z","dependencies_parsed_at":"2022-08-25T12:22:26.129Z","dependency_job_id":null,"html_url":"https://github.com/isleofcode/ember-changed-relationships","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isleofcode%2Fember-changed-relationships","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isleofcode%2Fember-changed-relationships/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isleofcode%2Fember-changed-relationships/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isleofcode%2Fember-changed-relationships/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isleofcode","download_url":"https://codeload.github.com/isleofcode/ember-changed-relationships/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225483147,"owners_count":17481307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T07:19:21.147Z","updated_at":"2024-11-22T07:19:21.654Z","avatar_url":"https://github.com/isleofcode.png","language":"JavaScript","readme":"# ember-changed-relationships\n\n[![Build Status](https://travis-ci.org/isleofcode/ember-changed-relationships.svg?branch=master)](https://travis-ci.org/isleofcode/ember-changed-relationships)\n\nProvides a mixin that can be imported to your models adding a single function, `changedRelationships`. It works similar to `changedAttributes`. Use selectively.\n\n## Installation\n\n* `ember install ember-changed-relationships`\n\n## Usage\n\nSimply call `changedRelationships` on a model.\n\nGiven:\n\n```\nimport ChangedRelationships from 'ember-changed-relationships';\n\nconst {\n  Model,\n  belongsTo,\n  hasMany\n} = DS;\n\nexport default Model.extend(\n  ChangedRelationships, {\n\n  user: belongsTo(), //initial state to user with id 1\n  items: hasMany() //inital state to ids [1,2,3]\n}\n```\n\nafter calling:\n```\nmodel.set('user', newUser); //id 2\nmodel.set('items', newItems); //ids [2,3]\n```\n\nYou would be returned:\n```\nrelationships: {\n  user: [1,2],\n  items: [ [1,2,3], [2,3] ]\n}\n```\n\nAfter each `model.save()`, the canonical state will reset.\n\n## Credits\n\nember-changed-relationships is maintained by [Isle of Code](https://isleofcode.com).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisleofcode%2Fember-changed-relationships","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisleofcode%2Fember-changed-relationships","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisleofcode%2Fember-changed-relationships/lists"}