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
140
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
570
GIT - Good Practices
wafcio
0
54
Dry System
wafcio
0
89
dry-validations
wafcio
0
150
Validations in Ruby
wafcio
0
160
Generating a CSV file with ROM
wafcio
0
270
Trailblazer bez trailblazera
wafcio
0
190
ActiveRecord, DataMapper czy Agregacja encji
wafcio
0
140
Jak (nie) używać Service Object
wafcio
0
170
Other Decks in Programming
See All in Programming
PHP ステートレス VS ステートフル 状態管理と並行性 / php-stateless-stateful
ytake
0
110
Pulsar2 を雰囲気で使ってみよう
anoken
0
250
一休.com のログイン体験を支える技術 〜Web Components x Vue.js 活用事例と最適化について〜
atsumim
0
810
負債になりにくいCSSをデザイナとつくるには?
fsubal
10
2.5k
CI改善もDatadogとともに
taumu
0
180
楽しく向き合う例外対応
okutsu
0
570
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
150
新宿駅構内を三人称視点で探索してみる
satoshi7190
2
110
GoとPHPのインターフェイスの違い
shimabox
2
200
ナレッジイネイブリングにAIを活用してみる ゆるSRE勉強会 #9
nealle
0
130
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
130
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
3
260
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
328
21k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
10
1.3k
How GitHub (no longer) Works
holman
314
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
A Modern Web Designer's Workflow
chriscoyier
693
190k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Adopting Sorbet at Scale
ufuk
74
9.2k
GitHub's CSS Performance
jonrohan
1030
460k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.3k
Making Projects Easy
brettharned
116
6k
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