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
Rails Maintainance Headaches
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
pete higgins
July 03, 2013
Programming
0
140
Rails Maintainance Headaches
pete higgins
July 03, 2013
Tweet
Share
More Decks by pete higgins
See All by pete higgins
Help Seattle.rb
phiggins
0
88
Rails Archeology
phiggins
2
120
Webmock
phiggins
0
76
Ruby Stdlib's Benchmark
phiggins
0
67
Hacking Ruby
phiggins
3
220
Lightweight Objects Seattle.rb
phiggins
1
84
Cute Animals You've Never Heard Of
phiggins
0
480
Other Decks in Programming
See All in Programming
SourceGeneratorのススメ
htkym
0
190
Data-Centric Kaggle
isax1015
2
770
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
AI時代の認知負荷との向き合い方
optfit
0
160
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
270
Grafana:建立系統全知視角的捷徑
blueswen
0
330
Oxlintはいいぞ
yug1224
5
1.3k
AI巻き込み型コードレビューのススメ
nealle
1
170
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
ThorVG Viewer In VS Code
nors
0
770
Patterns of Patterns
denyspoltorak
0
1.4k
Featured
See All Featured
Docker and Python
trallard
47
3.7k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Ruling the World: When Life Gets Gamed
codingconduct
0
140
Typedesign – Prime Four
hannesfritz
42
2.9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
320
It's Worth the Effort
3n
188
29k
ラッコキーワード サービス紹介資料
rakko
1
2.3M
Writing Fast Ruby
sferik
630
62k
Making Projects Easy
brettharned
120
6.6k
Navigating Weather and Climate Data
rabernat
0
100
Transcript
Rails Bad Practices Pete Higgins Seattle.rb
Me twitter: @pete_higgins github: @phiggins
Not me
Not me
Me
Me
“Why should I listen to you?”
What this isn't * An excuse to bash Rails *
Performance optimization * Comprehensive
What this isn't * An excuse to bash Rails *
Performance optimization
What this isn't * An excuse to bash Rails *
Performance optimization * A comprehensive list
Comprehensive * I am not a ZOMG Expert
Comprehensive * I am not a ZOMG Expert * “Do
these things and your code is fixed”
“Then what is this about?”
DHH Inventor of Rails and race cars. Original screencast: http://rubyonrails.ytmnd.com/
High level things I am obligated to mention
Comments
Cleverness Widget. where(foo_id:id). pluck(:timestamp). map(&:to_i). reduce(:-). abs
Debugging this ¯\_( ツ )_/¯
Cleverness Widget. where(foo_id:id). pluck(:timestamp). map(&:to_i). reduce(:-). abs
Resources are database models
Resources are not necessarily database models
Resources resource :profile, only: [:edit, :update] do member do get
'photo' => 'profile#edit_photo' post 'photo' => 'profile#update_photo' get 'crop_photo' end end
Resources resource :photo, only: [:edit, :create] resource :profile, only: [:edit,
:update]
Resources
Resources
Resources * Do one thing in controller / actions.
Cleverness * ActiveRecord callbacks. * Observers.
Resources * Do one thing in controller / actions. *
Delegate to other objects.
Models * Service Objects, Factories, Builders, non-ActiveRecord models.
Remove logic from views * Use view objects, presenters, form
objects, decorators, etc.
Use Ruby * What you call it isn't important. *
Not everything has to be a controller, model, helper or view.
Avoid @ivars def page @page ||= params[:page] || 1 end
private :page helper_method :page
Avoid @ivars def page @page ||= params[:page] || 1 end
private :page helper_method :page * rubygems.org/gems/ decent_exposure
None
Questions? twitter: @pete_higgins github: @phiggins