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
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.1k
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
ヘンリー会社紹介資料(エンジニア向け) / company deck for engineer
henryofficial
0
430
プロダクト開発と社内データ活用での、BI×AIの現在地 / Data_Findy
sansan_randd
1
660
SREのキャリアから経営に近づく - Enterprise Risk Managementを基に -
shonansurvivors
1
490
20251029_Cursor Meetup Tokyo #02_MK_「あなたのAI、私のシェル」 - プロンプトインジェクションによるエージェントのハイジャック
mk0721
PRO
6
2k
AI駆動で進める依存ライブラリ更新 ─ Vue プロジェクトの品質向上と開発スピード改善の実践録
sayn0
1
350
AIがコードを書いてくれるなら、新米エンジニアは何をする? / komekaigi2025
nkzn
20
12k
AWS re:Invent 2025事前勉強会資料 / AWS re:Invent 2025 pre study meetup
kinunori
0
870
文字列操作の達人になる ~ Kotlinの文字列の便利な世界 ~ - Kotlin fest 2025
tomorrowkey
2
230
ゼロコード計装導入後のカスタム計装でさらに可観測性を高めよう
sansantech
PRO
1
580
組織全員で向き合うAI Readyなデータ利活用
gappy50
5
1.8k
webpack依存からの脱却!快適フロントエンド開発をViteで実現する #vuefes
bengo4com
4
3.8k
Open Table Format (OTF) が必要になった背景とその機能 (2025.10.28)
simosako
2
510
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
22k
How to Think Like a Performance Engineer
csswizardry
27
2.2k
Keith and Marios Guide to Fast Websites
keithpitt
411
23k
The Cult of Friendly URLs
andyhume
79
6.6k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.5k
Done Done
chrislema
185
16k
Speed Design
sergeychernyshev
32
1.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
The Pragmatic Product Professional
lauravandoore
36
7k
Agile that works and the tools we love
rasmusluckow
331
21k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
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*