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
250
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ember Data: (Advanced) Patterns
Slides for my talk from EmberFest 2013
Paul Chavard
September 20, 2013
More Decks by Paul Chavard
See All by Paul Chavard
Le Tour du monde en quatre-vingts jours
tchak
1
58
Functional Ember
tchak
0
290
HTTP
tchak
3
210
Ember Data REBOOT
tchak
0
160
EmberJS Introduction
tchak
1
200
From SproutCore to Ember
tchak
2
260
Ember Data
tchak
11
850
Ember.js
tchak
10
1.6k
Other Decks in Programming
See All in Programming
Oxlintはいいぞ(続)
yug1224
1
320
バグを直したら useEffect が消えた
colorful12
3
670
Hono + Inertia + React で LP を構築した話
oukayuka
2
120
「人を評価する AI」の設計と実装
ryoyanara
0
220
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
930
React本体のコードリーディング
high_g_engineer
1
150
FastAPI の並行処理モデルを完全に理解する
hoto17296
6
2.2k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
180
typoなんかねぇよ
raspython3
0
190
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
200
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
350
Featured
See All Featured
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
340
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.3k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
220
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Agile that works and the tools we love
rasmusluckow
331
22k
Odyssey Design
rkendrick25
PRO
2
770
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
440
Producing Creativity
orderedlist
PRO
348
40k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
370
How to make the Groovebox
asonas
2
2.3k
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