< script src ="js/libs/ember-data.js "> </ script >
Switch to ember data model
App . Project = DS . Model . extend ( {
name : DS . attr ( 'string' ) ,
description : DS . attr ( 'string' ) ,
url : DS . attr ( 'string' ) ,
isArchived : DS . attr ( 'boolean' )
} ) ;
Switch to ember data FixtureAdapter
App . ApplicationAdapter = DS . FixtureAdapter . extend ( ) ;
App . Project . FIXTURES
Switch to ember data store
this . store . find ( 'project' ) ;
this . store . find ( 'project' , params . id ) ;
actions: {
'archive-project' : function ( ) {
var model = this . get ( 'model' ) ;
model . set ( 'isArchived' , true ) ;
model . save ( ) ;
this . transitionToRoute ( 'index' ) ;
}
}
Add filtering via IndexController
App . IndexController = Ember . ArrayController . extend ( {
nonArchivedProject : function ( ) {
return this . get ( 'model' ) . filterBy ( 'isArchived' , false )
} . property ( 'model.@each.isArchived' )
} )
{ { #each nonArchivedProject } }
< script src ="js/libs/firebase.js "> </ script >
< script src ="js/libs/emberfire-latest.js "> </ script >
App . ApplicationAdapter = DS . FirebaseAdapter . extend ( {
firebase : new Firebase ( "https://rahult.firebaseio.com/" )
} ) ;