Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ember Data: (Advanced) Patterns
Search
Paul Chavard
September 20, 2013
Programming
260
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
Transcript
8 slides
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
More Decks by Paul Chavard
See All by Paul Chavard
Le Tour du monde en quatre-vingts jours
tchak
1
65
Functional Ember
tchak
0
300
HTTP
tchak
3
210
Ember Data REBOOT
tchak
0
170
EmberJS Introduction
tchak
1
210
From SproutCore to Ember
tchak
2
270
Ember Data
tchak
11
860
Ember.js
tchak
10
1.6k
Other Decks in Programming
See All in Programming
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
180
Debian JP Projectのサーバー構成
uwabami
1
170
はじめてのKubernetesコントリビューション
nasa9084
0
320
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
作れるエンジニアから、価値を届けるエンジニアへ
ryunakayama
1
770
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
110
Kotlin JVM用に作られたライブラリのKMPを前提とした再設計
jsoizo
0
230
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
特急いなほ as a Workflow / 20261107jaws-festa-2026-akita-lt
kasacchiful
PRO
0
110
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
660
Featured
See All Featured
Designing for Performance
lara
612
70k
Fireside Chat
paigeccino
43
4.1k
Being A Developer After 40
akosma
PRO
92
590k
Balancing Empowerment & Direction
lara
6
1.4k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
2
560
Code Reviewing Like a Champion
maltzj
529
40k
New Earth Scene 8
popppiees
5
2.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k