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
57
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
継続モナドとリアクティブプログラミング
yukikurage
3
690
言語を使う側から、作る側へ。 自作 Lisp で得た新たな気づき。
andpad
0
160
Android CLI
fornewid
0
210
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.7k
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4k
数百円から始めるRuby電子工作
tarosay
0
140
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
370
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
580
源内ハンズオン概要編
hideg
0
120
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
310
React本体のコードリーディング
high_g_engineer
1
140
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
180
Featured
See All Featured
Context Engineering - Making Every Token Count
addyosmani
9
1k
Leo the Paperboy
mayatellez
8
2.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.3k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
530
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Claude Code のすすめ
schroneko
67
230k
Building Applications with DynamoDB
mza
96
7.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
GraphQLとの向き合い方2022年版
quramy
50
15k
Mobile First: as difficult as doing things right
swwweet
225
10k
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