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
85
Rails Archeology
phiggins
2
120
Webmock
phiggins
0
74
Ruby Stdlib's Benchmark
phiggins
0
66
Hacking Ruby
phiggins
3
220
Lightweight Objects Seattle.rb
phiggins
1
80
Cute Animals You've Never Heard Of
phiggins
0
470
Other Decks in Programming
See All in Programming
あなたとKaigi on Rails / Kaigi on Rails + You
shimoju
0
190
AI Agent 時代的開發者生存指南
eddie
4
2.1k
Google Opalで使える37のライブラリ
mickey_kubo
3
150
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
500
AI 駆動開発におけるコミュニティと AWS CDK の価値
konokenj
5
250
オープンソースソフトウェアへの解像度🔬
utam0k
17
3.1k
CSC305 Lecture 11
javiergs
PRO
0
270
Developer Joy - The New Paradigm
hollycummins
1
370
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
260
他言語経験者が Golangci-lint を最初のコーディングメンターにした話 / How Golangci-lint Became My First Coding Mentor: A Story from a Polyglot Programmer
uma31
0
430
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.9k
React Nativeならぬ"Vue Native"が実現するかも?_新世代マルチプラットフォーム開発フレームワークのLynxとLynxのVue.js対応を追ってみよう_Vue Lynx
yut0naga1_fa
2
1.5k
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
95
14k
How to train your dragon (web standard)
notwaldorf
97
6.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
640
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
Context Engineering - Making Every Token Count
addyosmani
8
300
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
How GitHub (no longer) Works
holman
315
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
22k
Balancing Empowerment & Direction
lara
5
700
Why Our Code Smells
bkeepers
PRO
340
57k
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