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
93
Rails Archeology
phiggins
2
130
Webmock
phiggins
0
82
Ruby Stdlib's Benchmark
phiggins
0
72
Hacking Ruby
phiggins
3
220
Lightweight Objects Seattle.rb
phiggins
1
88
Cute Animals You've Never Heard Of
phiggins
0
490
Other Decks in Programming
See All in Programming
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
210
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
210
Creating Composable Callables in Contemporary C++
rollbear
0
150
[2026年度第1回ORセミナー] 計画最適化ベンチャーと競技プログラミング人材
terryu16
0
270
Claspは野良GASの夢をみるか
takter00
0
200
Agentic UI
manfredsteyer
PRO
0
180
Performance Engineering for Everyone
elenatanasoiu
0
190
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
120
ふつうのFeature Flag実践入門
irof
8
4.1k
Oxlintのカスタムルールの現況
syumai
6
1.1k
Oxcを導入して開発体験が向上した話
yug1224
4
320
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
150
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
140
Ruling the World: When Life Gets Gamed
codingconduct
0
260
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Evolving SEO for Evolving Search Engines
ryanjones
0
220
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
Optimising Largest Contentful Paint
csswizardry
37
3.7k
Agile that works and the tools we love
rasmusluckow
331
21k
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