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
0
130
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
73
Rails Archeology
phiggins
2
110
Webmock
phiggins
0
58
Ruby Stdlib's Benchmark
phiggins
0
59
Hacking Ruby
phiggins
3
210
Lightweight Objects Seattle.rb
phiggins
1
72
Cute Animals You've Never Heard Of
phiggins
0
440
Other Decks in Programming
See All in Programming
Polars入門
daikikatsuragawa
1
170
検証も兼ねて個人開発でHonoとかと向き合った話
hanetsuki
1
1.3k
新宿ダンジョンを可視化してみた
satoshi7190
3
380
CDKコントリビュートの最初の壁を越えよう! -簡単issueの見つけ方-
badmintoncryer
3
200
見た目から始める生産性向上
ikumatadokoro
10
1.3k
Apache Hive 4 on Treasure Data
ryukobayashi
1
420
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
27
8.5k
Elm Form Validation
bkuhlmann
0
510
CA.swift19 恋するAIアプリ開発の裏側
oskmr
0
380
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
160
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
420
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
222
21k
Thoughts on Productivity
jonyablonski
60
3.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
Designing Experiences People Love
moore
136
23k
How to Ace a Technical Interview
jacobian
273
22k
Atom: Resistance is Futile
akmur
260
25k
From Idea to $5000 a Month in 5 Months
shpigford
378
45k
RailsConf 2023
tenderlove
8
550
Testing 201, or: Great Expectations
jmmastey
30
6.4k
What's in a price? How to price your products and services
michaelherold
238
11k
Creatively Recalculating Your Daily Design Routine
revolveconf
211
11k
How GitHub (no longer) Works
holman
305
140k
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