I am getting this.get(…).deleteRecord is not a function. I am sending my files
index.html
Ember Starter Kitapp.js
window.App = Ember.Application.create({ LOG_TRANSITIONS: true }); //App.ApplicationAdapter = DS.FixtureAdapter.extend();
/App.Router.map(function() {
this.route(‘about’, {path : ‘about’});
this.route(‘posts’, {path : ‘posts’});
this.resource(‘post’, { path : ‘:post_id’});
});/
App.Router.map(function() {
this.route(‘about’, {path : ‘about’});
this.route(‘posts’, function(){
this.resource(‘post’, { path : ‘:post_id’});
});
});
App.posts= [{
id:‘1’,
title: ‘Angular JS’,
author: {name: ‘Sandeep Rajpathak’},
date: ‘18-05-2015’,
developedBy:‘Sandeep’,
excerpt:‘There are lot of softwares available in this world. Great people are working hard on this now a days’,
body:‘Angular JS is Java Script Frame work, to build Single Page Applications’
},
{
id:‘2’,
title: ‘Ember JS’,
author: {name: ‘Tapas Ranjan’},
date: new Date(‘18-06-2015’),
developedBy:‘Tapas’,
excerpt:‘There are lot of softwares available in this world. Great people are working hard on this now a days’,
body:‘Ember JS is Java Script Framework , to build Browser based Single Page Applications’
},
{
id:‘3’,
title: ‘BootStrap JS’,
author: {name: ‘Hemanth Koruturu’},
date: new Date(‘18-08-2015’),
developedBy:‘Hemanth’,
excerpt:‘There are lot of softwares available in this world. Great people are working hard on this now a days’,
body:‘BootStrap is CSS Frame Work, to build Responsive Web based Applications’
}
];
App.PostsRoute = Ember.Route.extend({ model: function() { return App.posts; } });
App.PostRoute = Ember.Route.extend({ model: function(params){ return App.posts.findBy(‘id’, params.post_id); } });
App.PostController = Ember.ObjectController.extend({
isEditing: false,
actions: {
edit: function(){
this.set('isEditing', true);
},
doneEditing: function(){
this.set('isEditing', false);
},
delete: function(){
this.get('model').deleteRecord();
this.get('model').save();
this.transitionTo('posts');
}}
});
Ember.Handlebars.helper(‘format-date’, function(date){
//return moment().startOf(date).fromNow();
return moment().calendar(date);
});
var showdown = new Showdown.converter();
Ember.Handlebars.helper(‘format-mark’, function(input){ return new Ember.Handlebars.SafeString(showdown.makeHtml(input)); //return moment().calendar();
});
App.IndexRoute = Ember.Route.extend({ redirect: function(){ this.transitionTo(‘about’); } });