GELight
September 27, 2018, 8:56pm
1
Hi there,
Feels very good to work with ember again.
I have to migrate a v2.13 application to Ember v3.4.
I generated a new app based on 3.4 and no I try to add all artifacts step by step.
I have 2 Questions so far:
Where or in which package is the old pluralize() method placed?
Where I have to place my adapter classes now?
This is my old adapter:
import Ember from 'ember';
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
urlForFindAll(modelName/*, snapshot*/) {
let baseUrl = this.buildURL();
return baseUrl + '/rest/' + Ember.String.pluralize(modelName) + '.json';
},
urlForFindRecord(id, modelName/*, snapshot*/) {
let baseUrl = this.buildURL();
return baseUrl + '/rest/' + Ember.String.pluralize(modelName) + '/' + id + '.json';
}
});
Best regards,
Mario
Pluralize is now in ember-inflector so you can import like so:
import { pluralize } from 'ember-inflector';
and then use like:
return baseUrl + '/rest/' + pluralize(modelName) + '.json';
As for where to put your adapter… I’m not on 3.4 yet but I’m pretty sure the adapter would still go in app/adapters/<adapter-name>.js
unless you’re trying out module unification.
1 Like
GELight
September 27, 2018, 9:32pm
3
Hi @dknutsen ,
Very thanks for the import.
After create a new app in 3.4 there was no adapter directory in my app directory.
Therefore my question about the right place
Mario
Ah yeah that’s probably not a default directory but it should still be right. You could always do an ember g adapter <adapter name>
and see where it puts that to be safe.
GELight
September 27, 2018, 10:46pm
5
Ah… very good idea.
Thanks …
Mario
nik
September 28, 2018, 7:41am
6
For your further use cases of searching for ES6 imports:
Ember Data 2.3, a minor version release of Ember Data, is released today. This release represents the work of over 32 direct contributors, and over 196 commits. Ember Data 2.4 beta....
GELight
September 28, 2018, 6:37pm
7
Wow … many thanks for these links.
Very helpful.
Best regards,
Mario