Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ember and Rails
Search
Steve Kinney
December 17, 2014
0
88
Ember and Rails
Steve Kinney
December 17, 2014
Tweet
Share
More Decks by Steve Kinney
See All by Steve Kinney
Introduction to Testing
stevekinney
0
110
Web Security, Frontend Masters
stevekinney
0
3.2k
Making Music with the Web Audio API, JSConf Colombia 2023
stevekinney
0
100
React and TypeScript, Turing School
stevekinney
0
340
Redux Workshop, 2021-05-05
stevekinney
2
2.2k
TypeScript and React Utility Types
stevekinney
1
200
A Gentle Introduction to GraphQL Resolvers
stevekinney
1
160
React State
stevekinney
11
10k
React State: useEffect and Custom Hooks
stevekinney
0
240
Featured
See All Featured
How GitHub (no longer) Works
holman
316
140k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
32
GraphQLとの向き合い方2022年版
quramy
50
14k
Designing Experiences People Love
moore
143
24k
My Coaching Mixtape
mlcsv
0
6
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
63
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
390
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
0
25
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
ラッコキーワード サービス紹介資料
rakko
0
1.7M
Are puppies a ranking factor?
jonoalderson
0
2.3k
How Software Deployment tools have changed in the past 20 years
geshan
0
29k
Transcript
Ember ♥ Rails DeRailed, December 2014
Hi. I'm Steve. @stevekinney
None
Hire our students, please: http://people.turing.io/
Ember Basics
Ember draws influence from Cocoa and Rails. It began it's
life as SproutCore 2.0.
Notable Features Two-way data binding Computed properties An emphasis on
URLs Convention over configuration
None
Let's look at some code.
Public Service Announcement: TurboLinks Considered Harmful
A Tale of Two MVCs
Ember and Rails both take MVC pretty seriously. (That said,
they both have a very different take on it.)
None
None
The route fetches the model and sets up the controller.
Controllers decorate the model and handle actions.
Controllers are singletons.
Let's say you visit /notes/1 and then you visit /notes/2.
It's the same controller, but the route has switched out the model.
Controllers maintain state.
Controllers can talk to each other.
What is Ember Data?
It's kind of like ActiveRecord, but for Ember—and different.
None
// models/post.js export default DS.Model.extend({ title: DS.attr('string'), body: DS.attr('text'), comments:
DS.hasMany('comments') }); // models/comment.js export default DS.Model.extend({ comment: DS.attr('string'), post: DS.belongsTo('post') });
And Now: An Example of the AJAX Requests Generated By
Ember Data
post.find('12').get('comments');
post.get('comments'); GET /posts { "posts": [ { "id": "12", "content":
"Super!", "comments": ["56", "58"] } ] }
GET /comments?ids[]=56&ids[]=58 { "comments": [ { "id": "56", "message": "Whatever",
"post": "12" }, { "id": "58", "message": "Something", "post": "12" } ] }
What just happened? Ember Data sent off two AJAX requests
to Rails in order to build the relation in the browser.
And then it cached the result in the Store.
Let's look at some code together.
Ember Tooling
The Ember Inspector
None
None
It's like the Rails command line tools, but for Ember—
and not that different.
None
Ember CLI allows you to proxy to a Rails server.
Request If Ember can't respond to a URL, it proxies
it on to Rails.
Thank you. Questions?