Skip to content

Latest commit

 

History

History
48 lines (38 loc) · 1.23 KB

UPGRADING.md

File metadata and controls

48 lines (38 loc) · 1.23 KB

Upgrading v1.x to 2.x

This document is here to show breaking changes when upgrading from v1.x to v2.x

attributeDescription

We decided that attributeDescription is way too long of a property name so we changed it to just description.

Before

validator('length', {
  attributeDescription: 'Username'
  max: 15
})

After

validator('length', {
  description: 'Username'
  max: 15
})

Messages

We realized that it was pretty difficult to override current messages or even add your own so we restructured the message object. We also moved from the deprecated Ember.String.fmt (%@) syntax to named curly placeholders.

Before

// app/validators/messages.js

export default {
  // List of all messages
  // ...
}

After

// app/validators/messages.js

import Messages from 'ember-cp-validations/validators/messages';

export default Messages.extend({
  invalid: '{description} is wrong' // Override
  uniqueUsername: '{description} {username} already exists' // New
});

The base message object has many public hooks and properties exposed to better adapt to your specific application.