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
Slim Ruby on Rails: Controllers & Middlewares
Search
Krzysztof Wawer
June 21, 2017
Programming
1
180
Slim Ruby on Rails: Controllers & Middlewares
Krzysztof Wawer
June 21, 2017
Tweet
Share
More Decks by Krzysztof Wawer
See All by Krzysztof Wawer
The Good Architecture
wafcio
0
630
GIT - Good Practices
wafcio
0
75
Dry System
wafcio
0
110
dry-validations
wafcio
0
170
Validations in Ruby
wafcio
0
190
Generating a CSV file with ROM
wafcio
0
320
Trailblazer bez trailblazera
wafcio
0
220
ActiveRecord, DataMapper czy Agregacja encji
wafcio
0
180
Jak (nie) używać Service Object
wafcio
0
210
Other Decks in Programming
See All in Programming
(Extension DC 2025) Actor境界を越える技術
teamhimeh
1
250
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
250
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
3.3k
Go言語はstack overflowの夢を見るか?
logica0419
0
270
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.1k
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
760
CSC305 Lecture 05
javiergs
PRO
0
210
Claude CodeによるAI駆動開発の実践 〜そこから見えてきたこれからのプログラミング〜
iriikeita
0
210
Le côté obscur des IA génératives
pascallemerrer
0
140
TFLintカスタムプラグインで始める Terraformコード品質管理
bells17
2
170
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
220
スマホから Youtube Shortsを見られないようにする
lemolatoon
27
32k
Featured
See All Featured
Typedesign – Prime Four
hannesfritz
42
2.8k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
620
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
115
20k
Faster Mobile Websites
deanohume
310
31k
Rails Girls Zürich Keynote
gr2m
95
14k
Leading Effective Engineering Teams in the AI Era
addyosmani
4
390
Bash Introduction
62gerente
615
210k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.4k
What's in a price? How to price your products and services
michaelherold
246
12k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
The Straight Up "How To Draw Better" Workshop
denniskardys
238
140k
Transcript
Slim Ruby on Rails: Controllers & Middlewares Krzysztof Wawer
Request https://medium.com/@christemple/what-is-rack-in-ruby-7e0615f1d9b6
Request Rack App Middlewares log auth cache HTTP Request HTTP
Response
Middleware
Rack Middleware http://railscasts.com/episodes/151-rack-middleware
Ruby on Rails Middleware stack $ rails new app $
rails new app --api $ rake middleware http://guides.rubyonrails.org/rails_on_rack.html#configuring-middleware-stack
Ruby on Rails Middleware stack use Rack::MethodOverride use Sprockets::Rails::QuietAssets use
WebConsole::Middleware use ActionDispatch::Cookies use ActionDispatch::Session::CookieStore use ActionDispatch::Flash http://guides.rubyonrails.org/rails_on_rack.html#configuring-middleware-stack
RoR Middlewares problem https://github.com/rails/rails/blob/master/railties/lib/rails/application/default_middleware_stack.rb
http://paulserraino.com/rails/2016/02/29/rails-mountable-engines.html Rails Engines
Ruby on Rails Engine http://tech.taskrabbit.com/blog/2014/02/11/rails-4-engines/
Controller
None
None
ActionController::Base http://api.rubyonrails.org/classes/ActionController/Base.html
ActionController::API http://api.rubyonrails.org/classes/ActionController/API.html
ActionController::Metal http://api.rubyonrails.org/classes/ActionController/Metal.html
ActionController::API http://api.rubyonrails.org/classes/ActionController/API.html
Why ?
• Strong Parameters • Params Wrapper
• Strong Parameters • Params Wrapper Mapping
Mapping - missing part Nested Attributes - revealing structure