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
23
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
ファシリテーションテクニック / facilitation technic
kengohayata
0
12
SQLの実行計画とは / What is an SQL execution plan
kengohayata
0
23
Ruby Silverを取得してみた / get ruby silver
kengohayata
0
20
Ruby と Rails のざっくりとした Cookie の扱い方 / use cookie for ruby and rails
kengohayata
0
55
【LT会】進数を学ぼう! / study base number
kengohayata
0
16
【LT会】睡眠テクニックを身につける / study sleep technique
kengohayata
0
63
エンジニア座談会告知
kengohayata
0
63
未経験転職エンジニア座談会資料
kengohayata
0
59
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.5k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Design in an AI World
tapps
0
120
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
Docker and Python
trallard
47
3.7k
Utilizing Notion as your number one productivity tool
mfonobong
2
200
Side Projects
sachag
455
43k
4 Signs Your Business is Dying
shpigford
187
22k
Statistics for Hackers
jakevdp
799
230k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
730
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
58
41k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
44
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をできる限り 削除したらしい
他のデザインパターンも学習するぞ