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
53
Functional Ember
tchak
0
290
HTTP
tchak
3
210
Ember Data REBOOT
tchak
0
150
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
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
170
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
AIエージェントで 変わるAndroid開発環境
takahirom
1
440
SLOをサービス品質の共通言語にするために 取り組んできたこと
wakana0222
0
370
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
570
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
830
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
140
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
14
6.7k
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1k
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.7k
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
280
Featured
See All Featured
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
280
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
500
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
450
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Making the Leap to Tech Lead
cromwellryan
135
10k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
1.9k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
300
The Curious Case for Waylosing
cassininazir
1
430
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
How STYLIGHT went responsive
nonsquared
100
6.2k
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