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
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.2k
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.5k
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
470
CSC307 Lecture 04
javiergs
PRO
0
660
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
5
470
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
130
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
1
100
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
5
750
Oxlint JS plugins
kazupon
1
970
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
460
Featured
See All Featured
For a Future-Friendly Web
brad_frost
182
10k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
A Tale of Four Properties
chriscoyier
162
24k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
290
Odyssey Design
rkendrick25
PRO
1
500
Abbi's Birthday
coloredviolet
1
4.8k
So, you think you're a good person
axbom
PRO
2
1.9k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
96
We Have a Design System, Now What?
morganepeng
54
8k
Optimizing for Happiness
mojombo
379
71k
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