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
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
開発に寄りそう自動テストの実現
goyoki
2
1.7k
Developing static sites with Ruby
okuramasafumi
0
340
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
210
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
290
マスタデータ問題、マイクロサービスでどう解くか
kts
0
170
perlをWebAssembly上で動かすと何が嬉しいの??? / Where does Perl-on-Wasm actually make sense?
mackee
0
270
Cell-Based Architecture
larchanjo
0
160
GoLab2025 Recap
kuro_kurorrr
0
790
CSC307 Lecture 03
javiergs
PRO
1
450
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
4
260
gunshi
kazupon
1
130
はじめてのカスタムエージェント【GitHub Copilot Agent Mode編】
satoshi256kbyte
0
140
Featured
See All Featured
SEO for Brand Visibility & Recognition
aleyda
0
4.1k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
220
Being A Developer After 40
akosma
91
590k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
89
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
76
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Deep Space Network (abreviated)
tonyrice
0
32
Producing Creativity
orderedlist
PRO
348
40k
Writing Fast Ruby
sferik
630
62k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Typedesign – Prime Four
hannesfritz
42
2.9k
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