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
220
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Slim Ruby on Rails: Controllers & Middlewares
Krzysztof Wawer
June 21, 2017
More Decks by Krzysztof Wawer
See All by Krzysztof Wawer
The Good Architecture
wafcio
0
680
GIT - Good Practices
wafcio
0
110
Dry System
wafcio
0
130
dry-validations
wafcio
0
200
Validations in Ruby
wafcio
0
210
Generating a CSV file with ROM
wafcio
0
380
Trailblazer bez trailblazera
wafcio
0
260
ActiveRecord, DataMapper czy Agregacja encji
wafcio
0
220
Jak (nie) używać Service Object
wafcio
0
250
Other Decks in Programming
See All in Programming
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
150
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.4k
プロポーザルを書いてもらう
pvcresin
0
570
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
320
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
200
Android CLI
fornewid
0
230
バグを直したら useEffect が消えた
colorful12
3
670
AIと壁打ちしながら進めるコスト管理
fufuhu
1
1.4k
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
350
「つくるAI」だけではバグは見つからない ~テストに必要な「見つけるAI」を分離させる戦略~
mfunaki
0
140
わからない話を追いかけたら、プログラミング言語を作る側にいた
ydah
3
530
ソフトウェアラスタライザ
fadis
1
320
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
210
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
210
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
730
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
500
Into the Great Unknown - MozCon
thekraken
41
2.7k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
170
Navigating Team Friction
lara
192
16k
Between Models and Reality
mayunak
4
400
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
660
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
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