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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
38
Functional Ember
tchak
0
290
HTTP
tchak
3
190
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
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
150
Fluid Templating in TYPO3 14
s2b
0
130
AI & Enginnering
codelynx
0
110
Oxlint JS plugins
kazupon
1
760
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
4
320
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
6k
そのAIレビュー、レビューしてますか? / Are you reviewing those AI reviews?
rkaga
6
4.5k
CSC307 Lecture 03
javiergs
PRO
1
490
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
500
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
150
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.8k
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
250
Featured
See All Featured
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
The agentic SEO stack - context over prompts
schlessera
0
630
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
The Limits of Empathy - UXLibs8
cassininazir
1
210
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
A Tale of Four Properties
chriscoyier
162
24k
Skip the Path - Find Your Career Trail
mkilby
0
53
Technical Leadership for Architectural Decision Making
baasie
1
240
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
57
50k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
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