Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ember Data: (Advanced) Patterns
Search
Paul Chavard
September 20, 2013
Programming
2
240
Ember Data: (Advanced) Patterns
Slides for my talk from EmberFest 2013
Paul Chavard
September 20, 2013
Tweet
Share
More Decks by Paul Chavard
See All by Paul Chavard
Le Tour du monde en quatre-vingts jours
tchak
1
39
Functional Ember
tchak
0
290
HTTP
tchak
3
200
Ember Data REBOOT
tchak
0
140
EmberJS Introduction
tchak
1
200
From SproutCore to Ember
tchak
2
250
Ember Data
tchak
11
830
Ember.js
tchak
10
1.6k
Other Decks in Programming
See All in Programming
文字コードの話
qnighy
44
17k
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
300
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
120
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
110
Windows on Ryzen and I
seosoft
0
310
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
190
TipKitTips
ktcryomm
0
170
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
340
ふつうのRubyist、ちいさなデバイス、大きな一年 / Ordinary Rubyists, Tiny Devices, Big Year
chobishiba
1
470
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
270
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
290
Rで始めるML・LLM活用入門
wakamatsu_takumu
0
190
Featured
See All Featured
Color Theory Basics | Prateek | Gurzu
gurzu
0
250
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
63
51k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
From π to Pie charts
rasagy
0
150
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
150
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
560
Mobile First: as difficult as doing things right
swwweet
225
10k
Side Projects
sachag
455
43k
The SEO Collaboration Effect
kristinabergwall1
0
400
Speed Design
sergeychernyshev
33
1.6k
Transcript
Ember Data (Advanced) Patterns Paul Chavard Capitaine Train August 30,
2013
Capitaine Train capitainetrain.com • 55 controllers • 22 models
I am going to show you some useful stuff that
actualy works (most of the time) in Ember Data
Filters Dynamic Filter var IndexRoute = Ember.Route.extend ({ model: function
() { return this.store.filter(’post ’, {}, Ember.K); } }); var IndexController = Ember. ArrayController .extend ({ searchText : ’’, searchTextDidChange : function () { var searchText = this.get(’searchText ’). toLowerCase (); var filterFunction = Ember.isEmpty(searchText ) ? Ember.K : function(record) { return record.get(’title ’). toLowerCase () .match( searchText ); }; this.set(’content. filterFunction ’, filterFunction ); }. observes(’searchText ’) });
Batch Saves Save Multiple Models Ember.RSVP.all(post.get(’comments ’). invoke(’save ’)) .then(function
() { alert(’All Saved!’); }, function(reason) { alert(’There was an error because ’ + reason ); }); Save Parent Before Child post.save (). then(function () { return comment.save (); }). then(function () { alert(’All Saved!’); }, function(reason) { alert(’There was an error because ’ + reason ); });
Unload Records Unload Single Record this.store.find(’post ’, 1). unloadRecord ();
Unload Record with its Relationships var Post = DS.Model.extend ({ unloadRecord : function () { this._super (); this. eachRelationship (function(key , relationship ) { if ( relationship .kind === ’hasMany ’) { this.get(key ). toArray (). invoke(’unloadRecord ’); } else { this.get(key ). unloadRecord (); } }, this ); } }); this.store.find(’post ’, 1). unloadRecord ();
Ember Extention
The End