Having issues getting the activeModelAdapter to send a DELETE request on .destroyRecord, I also tried .deleteRecord with .save(), but get the same results....
ERROR
Started OPTIONS "/brands/117" for ::1 at 2015-04-20 17:51:05 -0700
ActionController::RoutingError (No route matches [OPTIONS] "/brands/117"):
BRANDS CONTROLLER
export default Ember.ArrayController.extend({
needs: 'application',
currentUser: Ember.computed.alias('controllers.application.currentUser'),
currentPath: Ember.computed.alias('controllers.application.currentPath'),
actions: {
deleteBrand: function(brand) {
brand.destroyRecord();
}
},
showButton: function() {
return this.currentPath === 'brands';
}.property('controllers.application.currentPath')
});
BRANDS TEMPLATE
<h2>Brands</h2>
{{#if showButton}}
{{#link-to 'brands.new' class="bam-btn submit login" tagName="button"}}Create A Brand{{/link-to}}
{{/if}}
{{outlet}}
{{search-brands}}
{{!-- LIST OF BRANDS --}}
<h2 class="bam-clear">List of {{ controllers.application.currentUser }} brands</h2>
<ul>
{{#each brand in model}}
{{#link-to 'brand.dashboard' brand.slug}}
<li><h3>{{brand.brand_name}}</h3></li>
<button id="deleteBrand" class="bam-btn alert" {{action 'deleteBrand' brand}}>Delete</button>
{{/link-to}}
{{/each}}
</ul>
Aucun commentaire:
Enregistrer un commentaire