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のQueryオブジェクトとは / What is a Query Object in...
Search
K H
September 12, 2024
0
6
RailsのQueryオブジェクトとは / What is a Query Object in Rails?
K H
September 12, 2024
Tweet
Share
More Decks by K H
See All by K H
SQLの実行計画とは / What is an SQL execution plan
kengohayata
0
6
Ruby Silverを取得してみた / get ruby silver
kengohayata
0
14
Ruby と Rails のざっくりとした Cookie の扱い方 / use cookie for ruby and rails
kengohayata
0
9
【LT会】進数を学ぼう! / study base number
kengohayata
0
10
【LT会】睡眠テクニックを身につける / study sleep technique
kengohayata
0
41
エンジニア座談会告知
kengohayata
0
23
未経験転職エンジニア座談会資料
kengohayata
0
39
Featured
See All Featured
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Optimizing for Happiness
mojombo
375
69k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.8k
How to train your dragon (web standard)
notwaldorf
87
5.6k
Practical Orchestrator
shlominoach
185
10k
Art, The Web, and Tiny UX
lynnandtonic
295
20k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
279
13k
Building an army of robots
kneath
302
42k
How to name files
jennybc
77
99k
Code Reviewing Like a Champion
maltzj
519
39k
Mobile First: as difficult as doing things right
swwweet
222
8.8k
Transcript
Queryオブジェクトとは
・デザインパターンは、再利用可能で効率的なコード設計を行うこと Fat ModelやFat Controller等の問題を回避できる ex) Decoratorオブジェクト、Formオブジェクトなど ・ModelやControllerの検索ロジックをQueryオブジェクトに分離す
ることで、再利用性の向上と責務の分離ができる Queryオブジェクトとは? ・Railsのデザインパターンの1つ
Queryオブジェクトの例
Queryオブジェクトを駆使すれば、gemの依存関係の回避につながる ・某イケてるRailsを使ったSaaS企業では、検索機能でgemを使わず Queryオブジェクトを使っているらしい ・gemはgem同士依存してメモリ使用量などパフォーマンスに影響するし、 バージョン管理が大変 ・shopifyではボトルネックになっていた500前後のgemをできる限り 削除したらしい
他のデザインパターンも学習するぞ