
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
ember-changeset-cp-validations
Advanced tools
Ember CP Validations support for Ember Changeset
ember install ember-changeset-cp-validations
If it is a bug please open an issue on GitHub.
This addon updates the changeset helper by creating a changeset instance via the createChangeset.
{{dummy-form
changeset=(changeset user)
submit=(action "submit")
rollback=(action "rollback")
}}
Passing a custom action as a second argument to the changeset helper is supported but make
sure to call the passed validate method to run the necessary validations.
{{dummy-form
changeset=(changeset user (action "customValidate"))
submit=(action "submit")
rollback=(action "rollback")
}}
import Ember from 'ember';
const { Component } = Ember;
export default Component.extend({
actions: {
customValidate({ key, newValue, oldValue, changes }, validate) {
// do some custom stuff
return validate(...arguments);
}
}
});
There are 2 ways to create a changset programmatically.
createChangeset is a no fuss way of quickly creating a new changeset instance.
It will return a new changeset instance that is setup for the passed model and its validations.
import Ember from 'ember';
import createChangeset from 'ember-changeset-cp-validations';
const { Component } = Ember;
export default Component.extend({
init() {
this._super(...arguments);
let model = get(this, 'model');
this.changeset = createChangeset(model);
}
});
buildChangeset allows you more freedom with creating the changeset instance.
It will return a hash that includes the validateFn and validationMap required to
support the validations for the passed model.
import Ember from 'ember';
import { buildChangeset } from 'ember-changeset-cp-validations';
const { Component } = Ember;
export default Component.extend({
init() {
this._super(...arguments);
let model = get(this, 'model');
let { validateFn, validationMap } = buildChangeset(model);
this.changeset = new Changeset(model, validateFn, validationMap);
}
});
When changes get applied to the actual model, validations will be re-triggered since the dependents of the CPs have changed. As of ember-cp-validations v3.1.0, to disable this, you may put all or selective attribute CPs in a volatile state via the volatile option.
const Validations = buildValidations({
username: {
description: 'Username',
validators: [
validator('presence', true),
validator('length', {
min: 5,
max: 15
})
]
},
password: {
description: 'Password',
validators: [
validator('presence', true),
validator('length', {
min: 4,
max: 10,
volatile: false
})
]
}
}, {
volatile: true
});
FAQs
Ember CP Validations support for Ember Changeset
We found that ember-changeset-cp-validations demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.