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
pete higgins
July 03, 2013
Programming
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rails Maintainance Headaches
pete higgins
July 03, 2013
More Decks by pete higgins
See All by pete higgins
Help Seattle.rb
phiggins
0
94
Rails Archeology
phiggins
2
130
Webmock
phiggins
0
83
Ruby Stdlib's Benchmark
phiggins
0
72
Hacking Ruby
phiggins
3
220
Lightweight Objects Seattle.rb
phiggins
1
90
Cute Animals You've Never Heard Of
phiggins
0
490
Other Decks in Programming
See All in Programming
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
180
ALB ログから Trace を気合で繋げる技術
fohte
3
330
片田舎のおっさん、 Swift Buildのダイアモンド問題解決の不具合修正PRを出すが、解決方法がキャッシュをしないようにすることであり、ビルド時間が伸びると言われてマージされないので高速化もする/swiftbuild
yimajo
0
280
まずはプロンプトガイドを読もう、話はそれからだ
kiakiraki
1
210
Dockerfile CMD for Node.js
grazie1999
0
120
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
3k
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
210
不幸な GC
chencmd
0
740
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
530
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
3
1.9k
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
2
1.2k
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
610
Featured
See All Featured
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
400
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
280
Measuring & Analyzing Core Web Vitals
bluesmoon
9
970
Exploring anti-patterns in Rails
aemeredith
3
470
Visualization
eitanlees
152
17k
Optimizing for Happiness
mojombo
378
71k
Deep Space Network (abreviated)
tonyrice
0
270
Why Our Code Smells
bkeepers
PRO
340
58k
GraphQLとの向き合い方2022年版
quramy
50
15k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
450
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
630
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