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
Off the Rails: Patterns for fixing fat models, ...
Search
Alexander Clark
April 23, 2019
Technology
0
350
Off the Rails: Patterns for fixing fat models, out-of-controllers, and other Rails problems
Alexander Clark
April 23, 2019
Tweet
Share
More Decks by Alexander Clark
See All by Alexander Clark
Docker: What It Is and Why You Should Care
alexanderclark
0
370
Building with Rack
alexanderclark
2
360
Other Decks in Technology
See All in Technology
Phase09_自動化_仕組み化
overflowinc
0
1.4k
コンテキスト・ハーネスエンジニアリングの現在
hirosatogamo
PRO
6
740
Kiro Meetup #7 Kiro アップデート (2025/12/15〜2026/3/20)
katzueno
2
230
めちゃくちゃ開発するQAエンジニアになって感じたメリットとこれからの課題感
ryuhei0000yamamoto
0
270
Kiroで見直す開発プロセスとAI-DLC
k_adachi_01
0
120
【PHPerKaigi2026】OpenTelemetry SDKを使ってPHPでAPMを自作する
fendo181
1
140
スピンアウト講座05_実践活用事例
overflowinc
0
970
「通るまでRe-run」から卒業!落ちないテストを書く勘所
asumikam
2
460
夢の無限スパゲッティ製造機 #phperkaigi
o0h
PRO
0
340
TypeScript 7.0の現在地と備え方
uhyo
7
2k
Windows ファイル共有(SMB)を再確認する
murachiakira
PRO
0
230
ADK + Gemini Enterprise で 外部 API 連携エージェント作るなら OAuth の仕組みを理解しておこう
kaz1437
0
150
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
300
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Un-Boring Meetings
codingconduct
0
230
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
180
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
First, design no harm
axbom
PRO
2
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Transcript
Off the Rails Patterns for fixing fat models, out-of-controllers, and
other Rails problems
What I’m about to tell you is wrong.
YMMV
MVC
View Controller Model
3 Tier Architecture
Business Logic Presentation Data
Business Logic Presentation Data
Business Logic Presentation Data View Controller Model
Business Logic Presentation Data View Controller Model
View Controller Model Business Logic Presentation Data
None
None
None
View Controller Model
Model Service View Controller
Business Logic Presentation Data
Business Logic Presentation Data
Business Logic Presentation Data Service
None
None
Controller Rule of Thumb A Controller May Contain: • Public
REST methods • Private before_action setters • Private strong params method
Models
Business Logic Presentation Data View Controller Model
Business Logic Presentation Data View Controller Model
Business Logic Presentation Data View Controller Model Repository
None
Business Logic Presentation Data View Controller Validator Model
None
None
None
None
–Sandi Metz “duplication is far cheaper than the wrong abstraction”
YAGNI
Bonus Tip
None
None
Thanks for Listening Alexander Clark atheclark alexander-clark.com alexander-clark
Further reading • https://codeclimate.com/blog/7-ways-to-decompose-fat- activerecord-models/ • Patterns of Enterprise Application
Architecture (Fowler) • Domain Driven Design (Evans) • All the Little Things (Metz) https://www.youtube.com/ watch?v=8bZh5LMaSmE • Ruby Object Mapper https://rom-rb.org/
Questions?