tenforce / ember-mu-application-generator

Generator for a full browseable CRUD front-end for a mu-cl-resources back-end.
MIT License
0 stars 3 forks source link

Plural names fix for has-many relationships #4

Closed lordblendi closed 7 years ago

lordblendi commented 7 years ago

When you ran a command with generating relationships, the mu-resource generator renamed the "single" named relations to plural. For example:

ember g mu-resource job title:language-string-set worker:has-many:person~job  

This command would generate:

import Ember from 'ember';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { hasMany } from 'ember-data/relationships';

export default Model.extend({
  // A string representation of this model, based on its attributes.
  // This is what mu-cl-resources uses to search on, and how the model will be presented while editing relationships.
  stringRep: Ember.computed.collect.apply(this,['id','title']),

  title: attr('language-string-set'),
  workers: hasMany('person', {inverse: 'job'})
});

Where the worker was renamed to workers. Vincent (@VulumeCode) fixed this on our gitlab. I just took the commits from there and pushed it here, as we cannot do pull requests from gitlab to github.