New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-changed-relationships

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-changed-relationships

Adds a changedRelationships function to models, similar to changedAttributes.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ember-changed-relationships

Build Status

Provides a mixin that can be imported to your models adding a single function, changedRelationships. It works similar to changedAttributes. Use selectively.

Installation

  • ember install ember-changed-relationships

Usage

Simply call changedRelationships on a model.

Given:

import ChangedRelationships from 'ember-changed-relationships';

const {
  Model,
  belongsTo,
  hasMany
} = DS;

export default Model.extend(
  ChangedRelationships, {

  user: belongsTo(), //initial state to user with id 1
  items: hasMany() //inital state to ids [1,2,3]
}

after calling:

model.set('user', newUser); //id 2
model.set('items', newItems); //ids [2,3]

You would be returned:

relationships: {
  user: [1,2],
  items: [ [1,2,3], [2,3] ]
}

After each model.save(), the canonical state will reset.

Credits

ember-changed-relationships is maintained by Isle of Code.

Keywords

FAQs

Package last updated on 28 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc