chore: rename adapterOptions.scope_id to adapterOptions.scopeID
This commit is contained in:
4 files changed
+16
-16
No files matched your search
@@ -60,7 +60,7 @@ export default class ApplicationAdapter extends RESTAdapter.extend(
|
||||
|
||||
/**
|
||||
* Prepends a scope to the URL prefix, if a scope is passed via the
|
||||
* snapshot's `adapterOptions.scope_id` field.
|
||||
* snapshot's `adapterOptions.scopeID` field.
|
||||
* @override
|
||||
* @param {string} path
|
||||
* @param {string} parentURL
|
||||
@@ -71,7 +71,7 @@ export default class ApplicationAdapter extends RESTAdapter.extend(
|
||||
*/
|
||||
urlPrefix(path, parentURL, modelName, id, snapshot={}) {
|
||||
const prefix = super.urlPrefix(...arguments);
|
||||
let scopePath = getWithDefault(snapshot, 'adapterOptions.scope_id', '');
|
||||
let scopePath = getWithDefault(snapshot, 'adapterOptions.scopeID', '');
|
||||
// Ensure a slash is added between prefix + scope path if needed.
|
||||
if (scopePath && prefix.charAt(prefix.length - 1) !== '/') {
|
||||
scopePath = `/${scopePath}`;
|
||||
|
||||
@@ -44,12 +44,12 @@ export default class BaseModel extends Model {
|
||||
|
||||
/**
|
||||
* If this model instance has a related scope, the scope's ID will be passed
|
||||
* via `adapterOptions.scope_id` automatically. End users may optionally
|
||||
* via `adapterOptions.scopeID` automatically. End users may optionally
|
||||
* pass a custom scope ID to override.
|
||||
*
|
||||
* @example
|
||||
* model.save(); // passes the model's current scope ID
|
||||
* model.save({adapterOptions: {scope_id: 'global'}}); // override scope ID
|
||||
* model.save({adapterOptions: {scopeID: 'global'}}); // override scope ID
|
||||
*
|
||||
* End users may specify a _custom method_ via `adapterOptions.method`.
|
||||
* Custom methods are appended to the record's URL by the adapter.
|
||||
@@ -62,8 +62,8 @@ export default class BaseModel extends Model {
|
||||
*/
|
||||
save(options={adapterOptions: {}}) {
|
||||
const scopeID = this.belongsTo('scope').id();
|
||||
if (scopeID && !options.adapterOptions.scope_id) {
|
||||
options.adapterOptions.scope_id = scopeID;
|
||||
if (scopeID && !options.adapterOptions.scopeID) {
|
||||
options.adapterOptions.scopeID = scopeID;
|
||||
}
|
||||
return super.save(options);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user