My API is using singular resource - Rails Routing from the Outside In — Ruby on Rails Guides
And i’m using the following code in a service to load the current user:
import Ember from ‘ember’;
export default Ember.Service.extend({
session: Ember.inject.service(),
store: Ember.inject.service(),
load() {
if (this.get('session.isAuthenticated')) {
return this.get('store').queryRecord('user', {
me: true
}).then((user) => {
this.set('user', user);
});
}
return Ember.RSVP.resolve();
}
});
SO in my routes dashboard/users/update
, i just need return the currentUser in order to show the information in the inputs, allowing the users to update something:
import Ember from 'ember';
export default Ember.Route.extend({
currentUser: Ember.inject.service(),
model() {
return this.get('currentUser.user');
}
});
But, when i try to use the save method, to make the request to the API, the request url is users/:id
, and this endpoint doesn’t exist in my backend, since i’m using singular resource. Is it possible to overwrite this behaviour??
Thank you.