These are chat archives for orbitjs/orbit.js

30th
Nov 2017
Gregory M Kohler
@gmkohler
Nov 30 2017 16:35

Hi all, what is the best way to override settings in a schema? I am looking to use ember-inflector's singularize and pluralize. My approach was to make a CustomSchemaFactory:

import { singularize, pluralize } from 'ember-inflector';
import { SchemaFactory } from 'ember-orbit';

export default {
  create(injections) {
    injections.singularize = singularize
    injections.pluralize = pluralize
    return SchemaFactory.create(injections);
  }
}

so that the Schema initialized in create will use those functions. I then register this in my app's initializers/orbit.js file at the key where the SchemaFactory is registered in ember-orbit's initializer:

import CustomSchemaFactory from 'app-name/lib/custom-schema-factory';

export default {
  name: 'orbit',

  initialize(application) {
    application.register('data-schema:main', CustomSchemaFactory);
  }
}
It looks like it's working, want to make sure I'm not missing a small detail
Dan Gebhardt
@dgeb
Nov 30 2017 21:31
@gmkohler sure, that should get the job done
we'll have some slightly better ergonomics after module unification lands in ember