@@ -81,20 +81,20 @@ From Source
8181 $ git clone https://github.com/ngenworks/rest_framework_ember.git
8282 $ cd rest_framework_ember && pip install -e .
8383
84-
84+
8585-----
8686Usage
8787-----
8888
8989
90- ``rest_framework_ember `` assumes you are using class-based views in Django
90+ ``rest_framework_ember `` assumes you are using class-based views in Django
9191Rest Framework.
9292
9393
9494Settings
9595^^^^^^^^
9696
97- One can either add ``rest_framework_ember.parsers.EmberJSONParser `` and
97+ One can either add ``rest_framework_ember.parsers.EmberJSONParser `` and
9898``rest_framework_ember.renderers.JSONRenderer `` to each ``ViewSet `` class, or
9999override ``settings.REST_FRAMEWORK ``::
100100
@@ -119,7 +119,7 @@ override ``settings.REST_FRAMEWORK``::
119119
120120
121121If ``PAGINATE_BY `` is set the renderer will return a ``meta `` object with
122- record count and the next and previous links. Django Rest Framework looks
122+ record count and the next and previous links. Django Rest Framework looks
123123for the ``page `` GET parameter by default allowing you to make requests for
124124subsets of the data with ``this.store.find('identity', {page: 2}); ``.
125125
@@ -142,5 +142,29 @@ the ``resource_name`` property is required on the class.::
142142 permission_classes = (permissions.IsAuthenticated, )
143143
144144
145+ Managing the trailing slash
146+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
147+
148+ By default Django expects a trailing slash on urls and will 301 redirect any
149+ requests lacking a trailing slash. You can change the server side by
150+ instantiating the Django REST Framework's router like so:
151+
152+ router = routers.SimpleRouter(trailing_slash=False)
145153
154+ If you aren't using SimpleRouter you can instead set APPEND_SLASH = False
155+ in Django's settings.py file and modify url pattern regex to match routes
156+ without a trailing slash.
157+
158+ If you prefer to make the change on the client side then add an
159+ application adapter to your Ember app and override the buildURL method:
160+
161+ App.ApplicationAdapter = DS.RESTAdapter.extend({
162+ buildURL: function() {
163+ var url = this._super.apply(this, arguments);
164+ if (url.charAt(url.length -1) !== '/') {
165+ url += '/';
166+ }
167+ return url;
168+ }
169+ });
146170
0 commit comments