v0.2.0-beta.9
Pre-releaseThis release contains some breaking changes from 0.2.0-beta.8.
Update notes:
-
Schema model classes are now pluralized. They used to be singularized, taking after Rails' conventions, but I think it's better to match our db conventions (e.g.
db.users).So you'll need to change
schema.user.all() schema.user.find(1)
to
schema.users.all() schema.users.find(1)
and so on. The upgrade should be a relatively straightforward.
-
Breaking changes on ORM/Collection:
-
There's now a
.modelsproperty on Collections, which gives you access to the underlying JavaScript array. This should be used if you want to munge the collection using Lodash, Ramda et al.let usersCollection = schema.users.all(); let uniqueUsers = _.uniq(usersCollection.models, u => u.firstName);
-
Collection no longer attempts to mimic an array. This turned out to be confusing, since you can't really subclass arrays in JavaScript, and it would sometimes be compatible with functions that operate on arrays, but sometimes not.
So, you can no longer use the array accessor on a collection, meaning the following won't work:
let authors = schema.authors.all(); // The following no longer work authors[1]; authors.length; authors.push(model); authors.map(f); authors.forEach(f); authors.reduce(f); authors.toArray(); // use authors.models instead
Instead, if you need to use array-methods on
Collections, access the.modelsproperty. You can always convert your transformed array back to aCollection, for example to tell Mirage to serialize your response:import { Collection } from 'ember-cli-mirage'; let authors = schema.authors.all().models; let topPosts = authors.map(a => a.topPost); return new Collection('post', topPosts);
-
Changes:
- [BREAKING CHANGE] #705 Drop Collection.[], add Collection.models @samselikoff
- [BREAKING CHANGE] #705 Pluralize Schema class names @samselikoff
- [FEATURE] #705 Add this.serialize to function route handlers @samselikoff
- [ENHANCEMENT] Server.create falls back to Models if Factories don't exist @samselikoff
- [ENHANCEMENT] Support aliases for --proxy @elbeezy
- [ENHANCEMENT] Do not include files if on Fastboot @locks
- [BUGFIX] #709 Fix Serializer include logic @cibernox
- [BUGFIX] #666 Ensure model serializers are used for JSONAPI @samselikoff
- General cleanup, updates and docs @lizzerdrix, @lependu, @amyrlam, @blimmer, @noslouch, @bgentry, @mitchlloyd, @BrianSipple, @acorncom, @stefanpennar