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
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
84
Rails Archeology
phiggins
2
120
Webmock
phiggins
0
73
Ruby Stdlib's Benchmark
phiggins
0
64
Hacking Ruby
phiggins
3
220
Lightweight Objects Seattle.rb
phiggins
1
79
Cute Animals You've Never Heard Of
phiggins
0
470
Other Decks in Programming
See All in Programming
OSS開発者という働き方
andpad
5
1.7k
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
270
Design Foundational Data Engineering Observability
sucitw
3
200
print("Hello, World")
eddie
2
530
そのAPI、誰のため? Androidライブラリ設計における利用者目線の実践テクニック
mkeeda
2
310
速いWebフレームワークを作る
yusukebe
5
1.7k
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
270
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.6k
rage against annotate_predecessor
junk0612
0
170
How Android Uses Data Structures Behind The Scenes
l2hyunwoo
0
460
Android 16 × Jetpack Composeで縦書きテキストエディタを作ろう / Vertical Text Editor with Compose on Android 16
cc4966
2
230
個人軟體時代
ethanhuang13
0
320
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
431
66k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
The World Runs on Bad Software
bkeepers
PRO
70
11k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Making Projects Easy
brettharned
117
6.4k
Making the Leap to Tech Lead
cromwellryan
135
9.5k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
A Tale of Four Properties
chriscoyier
160
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
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