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
Putting CRUD to REST: An Introduction to RESTfu...
Search
Viking Education
July 17, 2015
Technology
660
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Putting CRUD to REST: An Introduction to RESTful Routing by Dan Berger
Viking Education
July 17, 2015
More Decks by Viking Education
See All by Viking Education
Getting a Developer Job with a Non-Traditional Background
vikingeducation
1
1.7k
AirBnB Teardown: Behdad A.
vikingeducation
0
430
Viking Code School Presents Christopher Hendrix of Pivotal Labs
vikingeducation
0
190
Viking Blogger Demo: Design Phase
vikingeducation
2
3.5k
UX Teardown of Soundcloud
vikingeducation
0
3.2k
A Design Teardown of DN.se
vikingeducation
1
3.9k
Viking Blogger Demo: Introduction
vikingeducation
0
4.1k
Viking Blogger Demo: Discovery Phase
vikingeducation
0
4.1k
vb_3_strategy_phase_slides_pdf.pdf
vikingeducation
0
4k
Other Decks in Technology
See All in Technology
AI Native なプロダクト組織の立ち上げ方 : 生産性 100 倍への挑戦
mikesorae
0
1.5k
事業成長とAI活用を止めないデータ基盤アーキテクチャの設計思想
hiracky16
0
730
現場との対話から始める “作る前に問い直す”業務改善
mochico50
2
310
それでも、技術なブログを書く理由 #kichijojipm / Why I Still Write Tech Blogs Even Now
shinkufencer
0
980
PHPで作って学ぶリアルタイム音声対話AIとWebSocket入門 by ムナカタ
munakata
0
160
OPENLOGI Company Profile for engineer
hr01
1
75k
どこまでAIに任せるか 〜確率論と決定論の境界決定〜
shukob
0
540
インシデント事例と パッケージの全量解析に学ぶ ソフトウェアサプライチェーンの守り方 / supply-chain-attack-defense
flatt_security
0
1.1k
Git 研修【MIXI 26新卒技術研修】#2
mixi_engineers
PRO
1
260
AI驚き屋発見器
yama3133
1
330
Power Automateアップデート情報
miyakemito
0
260
Jitera Company Deck
jitera
0
580
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
180
Color Theory Basics | Prateek | Gurzu
gurzu
0
400
Paper Plane (Part 1)
katiecoart
PRO
1
9.8k
GitHub's CSS Performance
jonrohan
1033
470k
What does AI have to do with Human Rights?
axbom
PRO
1
2.3k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
A Soul's Torment
seathinner
6
3.1k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
420
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.7k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.3k
Transcript
Putting CRUD to REST
Goals - Briefly introduce you to Representational State Transfer, or
REST. - Give you a mental model for relating RESTful controller actions to CRUD principles.
Quick CRUD review - Create - Read - Update -
Delete
Read: Index & Show actions - Index reads all the
instances of this object. - @foos = Foo.all - Show reads one instance of this object. - @foo = Foo.find(params[:id]) - They are both HTML ‘get’ actions.
CRUD REST HTML Create Read index get show get Update
Delete
Create: New controller action - HTML ‘get’ request from browser
- Controller creates an empty object: - @foo = Foo.new - Controller sends “new” view to browser.
Create: Create controller action - HTML ‘post’ request from browser
- Controller creates an object with attributes: - @foo = Foo.new(params) - Controller saves the new object: - @foo.save
Create: full circle NEW ‘get’ the view and empty object
Controller CREATE ‘post’ the form params to the object and save
CRUD REST HTML Create new get create post Read index
get show get Update Delete
Update: Edit controller action - HTML ‘get’ request from browser
- Controller finds the target object in DB: - @foo = Foo.find(params[:id]) - Controller sends “edit” view to browser with complete params.
Update: Update controller action - HTML ‘put’ request from browser
- Controller updates the object’s attributes: - @foo = Foo.update(params) - Controller saves the object: - @foo.save
Update: full circle EDIT ‘get’ the view and object attributes
Controller UPDATE ‘put’ the form params to the object and save
CRUD REST HTML Create new get create post Read index
get show get Update edit get update put Delete
Delete: Destroy controller action - HTML ‘destroy’ request from browser
- actually a ‘get’ request with { method: delete } options hash - Controller finds the target object in DB: - @foo = Foo.find(params[:id]) - DESTROY!!!! - @foo.destroy
CRUD REST HTML Create new get create post Read index
get show get Update edit get update put Delete destroy destroy*
CRUD REST HTML Create new get create post Read index
get show get Update edit get update put Delete destroy destroy*