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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Viking Education
July 17, 2015
Technology
1
650
Putting CRUD to REST: An Introduction to RESTful Routing by Dan Berger
Viking Education
July 17, 2015
Tweet
Share
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活用術
tomfook
3
1.1k
CREがSLOを握ると 何が変わるのか
nekomaho
0
170
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
280
AIエージェント時代に必要な オペレーションマネージャーのロールとは
kentarofujii
0
190
Datadog で実現するセキュリティ対策 ~オブザーバビリティとセキュリティを 一緒にやると何がいいのか~
a2ush
0
170
The Rise of Browser Automation: AI-Powered Web Interaction in 2026
marcthompson_seo
0
310
OPENLOGI Company Profile for engineer
hr01
1
61k
「AIエージェントで変わる開発プロセス―レビューボトルネックからの脱却」
lycorptech_jp
PRO
0
170
OCI技術資料 : 証明書サービス概要
ocise
1
7.1k
GitHub Actions侵害 — 相次ぐ事例を振り返り、次なる脅威に備える
flatt_security
8
5.8k
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
5
1.2k
20260323_データ分析基盤でGeminiを使う話
1210yuichi0
0
190
Featured
See All Featured
Thoughts on Productivity
jonyablonski
75
5.1k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
310
Designing for humans not robots
tammielis
254
26k
Odyssey Design
rkendrick25
PRO
2
560
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
250
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
400
Tell your own story through comics
letsgokoyo
1
870
Building a Scalable Design System with Sketch
lauravandoore
463
34k
How to make the Groovebox
asonas
2
2k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
We Are The Robots
honzajavorek
0
200
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*