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
120
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
530
GIT - Good Practices
wafcio
0
45
Dry System
wafcio
0
87
dry-validations
wafcio
0
140
Validations in Ruby
wafcio
0
140
Generating a CSV file with ROM
wafcio
0
230
Trailblazer bez trailblazera
wafcio
0
160
ActiveRecord, DataMapper czy Agregacja encji
wafcio
0
110
Jak (nie) używać Service Object
wafcio
0
150
Other Decks in Programming
See All in Programming
ファーストペンギンBot @Qiita Hackathon 2024 予選
dyson_web
0
210
.NET Aspireのクラウド対応検証: Azureと他環境での実践
ymd65536
1
290
[KR] Server Driven Compose With Firebase
skydoves
2
160
dbt-ga4パッケージを実業務に導入してみた話
t_tokumaru_feedcorp
0
120
Compose Multiplatform과 Ktor로 플랫폼의 경계를 넘어보자
kwakeuijin
0
250
MLOps in Mercari Group’s Trust and Safety ML Team
cjhj
1
110
文化が生産性を作る
jimpei
3
510
ECS向けのドリフト検知機構を実装してみた
tkikuc
0
270
標準ライブラリの動向とイテレータのパフォーマンス
makki_d
3
190
XP2024 っていう国際会議に行ってきたよの記 / XP2024 Conference Report
bonotake
4
180
Unlocking Python's Core Magic
leew
0
120
M5Stack に色々な M5ユニットをつないで扱う為の新たなアプローチ
gob
0
200
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
30
1.4k
Designing Experiences People Love
moore
138
23k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Mobile First: as difficult as doing things right
swwweet
222
8.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
653
59k
Creatively Recalculating Your Daily Design Routine
revolveconf
217
12k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
249
21k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
7.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
324
23k
Building an army of robots
kneath
302
42k
Robots, Beer and Maslow
schacon
PRO
157
8.2k
GraphQLとの向き合い方2022年版
quramy
43
13k
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