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
78
Cute Animals You've Never Heard Of
phiggins
0
460
Other Decks in Programming
See All in Programming
Go1.25からのGOMAXPROCS
kuro_kurorrr
1
680
try-catchを使わないエラーハンドリング!? PHPでResult型の考え方を取り入れてみよう
kajitack
3
510
ASP.NETアプリケーションのモダナイズ インフラ編
tomokusaba
1
260
Cursor Meetup Tokyo ゲノミクスとCursor: 進化と制約のあいだ
koido
2
1k
Development of an App for Intuitive AI Learning - Blockly Summit 2025
teba_eleven
0
110
型付きアクターモデルがもたらす分散シミュレーションの未来
piyo7
0
780
関数型まつり2025登壇資料「関数プログラミングと再帰」
taisontsukada
2
820
Use Perl as Better Shell Script
karupanerura
0
690
從零到一:搭建你的第一個 Observability 平台
blueswen
1
920
A comprehensive view of refactoring
marabesi
0
480
レガシーシステムの機能調査・開発におけるAI利活用
takuya_ohtonari
0
600
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
630
Featured
See All Featured
Bash Introduction
62gerente
614
210k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Optimizing for Happiness
mojombo
379
70k
The Cult of Friendly URLs
andyhume
79
6.4k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.3k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Building a Modern Day E-commerce SEO Strategy
aleyda
41
7.3k
Designing for humans not robots
tammielis
253
25k
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