ebryn/ember-model — pull request #241 by heartsentwined (2013-09-10 11:39:35+00:00)
Title: allows custom `settings` for rest adapter's _ajax

This PR replaces the hard-coded computation of `ajaxSettings()` with a function parameter, allowing userland code to control the `settings` object passed to the rest adapter's `_ajax()` method.

The corresponding method signature of both `ember-data` and `epf`

```javascript
ajax(url, method, settings)
```

allows userland code to manipulate the `settings` directly, while that of `ember-model`, before this PR

```javascript
_ajax(url, params, method)
```

confines userland access to the data / params object.

One use case is to pass in extra headers.

This PR would allow [`ember-auth`] to integrate with `ember-model` better.

The corresponding `ember-data` integration, for example, can be done in `ember-auth` like

```coffeescript
DS.RESTAdapter.reopen
ajax: (url, type, settings) ->
super url, type, self.auth._strategy.serialize(settings || {})
```

thus preserving any `ember-data`-specific logic in its own `ajax` hook.

This is not possible for `ember-model`, before this PR, because there is no way to override the local `settings` variable

```javascript
var settings = this.ajaxSettings(url, method);
```

[`ember-auth`]: http://ember-auth.herokuapp.com/