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
220
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
34
Functional Ember
tchak
0
280
HTTP
tchak
3
190
Ember Data REBOOT
tchak
0
130
EmberJS Introduction
tchak
1
190
From SproutCore to Ember
tchak
2
240
Ember Data
tchak
11
810
Ember.js
tchak
11
1.6k
Other Decks in Programming
See All in Programming
サービスレベルを管理してアジャイルを加速しよう!! / slm-accelerate-agility
tomoyakitaura
1
200
Laravel × Clean Architecture
bumptakayuki
PRO
0
130
note の Elasticsearch 更新系を支える技術
tchov
9
3.4k
Instrumentsを使用した アプリのパフォーマンス向上方法
hinakko
0
230
iOSアプリで測る!名古屋駅までの 方向と距離
ryunakayama
0
150
今話題のMCPサーバーをFastAPIでサッと作ってみた
yuukis
0
110
音声プラットフォームのアーキテクチャ変遷から学ぶ、クラウドネイティブなバッチ処理 (20250422_CNDS2025_Batch_Architecture)
thousanda
0
380
2025-04-25 GitHub Copilot Agent ライブデモ(スクリプト)
goataka
0
100
Jakarta EE Meets AI
ivargrimstad
0
780
2ヶ月で生産性2倍、お買い物アプリ「カウシェ」4チーム同時改善の取り組み
ike002jp
1
110
インプロセスQAにおいて大事にしていること / In-process QA Meetup
medley
0
140
Enterprise Web App. Development (1): Build Tool Training Ver. 5
knakagawa
1
120
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
84
5.5k
We Have a Design System, Now What?
morganepeng
52
7.5k
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
4 Signs Your Business is Dying
shpigford
183
22k
Building Adaptive Systems
keathley
41
2.5k
A Tale of Four Properties
chriscoyier
159
23k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.5k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.8k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
45
9.5k
Thoughts on Productivity
jonyablonski
69
4.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