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
【2018/04/12 Otemachi.rb#5】has_one :throughの憂鬱
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Shu OGAWARA
April 12, 2018
Technology
0
420
【2018/04/12 Otemachi.rb#5】has_one :throughの憂鬱
2018/04/12 Otemachi.rb#5での発表資料です。
Shu OGAWARA
April 12, 2018
Tweet
Share
More Decks by Shu OGAWARA
See All by Shu OGAWARA
あなたの知らないDateのひみつ / The Secret of "Date" You Haven't known #tqrk16
expajp
0
140
入門 FormObject / An Introduction to FormObject #kaigionrails
expajp
2
5.7k
あなたの「仮説検証」、ゆがんでいませんか? / Isn't Your "Hypothesis Verification" Distorted? #emoasis
expajp
2
450
Rubyはなぜ「たのしい」のか? / Why is Ruby a programmers' best friend? #tqrk15
expajp
5
2.1k
エンジニアリングマネージャーはどう学んでいくのか #devsumi / How Do Engineering Managers Continue to Learn and Grow?
expajp
9
5.6k
RubyKaigi参加歴をふりかえる / Looking Back on My RubyKaigi Participation History #kaigieffectLT
expajp
3
560
わたしのメタ学習 / My Own Meta Learning #shinjukurb
expajp
0
500
ActiveSupport::Concernで開くメタプログラミングの扉 #heiseirubykaigi / The door of meta-programing is opened by ActiveSupport::Concern
expajp
1
2.4k
実践Railsアプリケーション設計 #meetup_rails / Practical Rails Application Design
expajp
4
40k
Other Decks in Technology
See All in Technology
AIが実装する時代、人間は仕様と検証を設計する
gotalab555
1
190
プロポーザルに込める段取り八分
shoheimitani
1
630
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
170
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
480
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
130
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
Cloud Runでコロプラが挑む 生成AI×ゲーム『神魔狩りのツクヨミ』の裏側
colopl
0
140
ECS障害を例に学ぶ、インシデント対応に備えたAIエージェントの育て方 / How to develop AI agents for incident response with ECS outage
iselegant
3
300
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
150
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
390
AIと新時代を切り拓く。これからのSREとメルカリIBISの挑戦
0gm
2
3.1k
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
1.6k
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
950
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
280
Deep Space Network (abreviated)
tonyrice
0
64
Leo the Paperboy
mayatellez
4
1.4k
We Have a Design System, Now What?
morganepeng
54
8k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
Amusing Abliteration
ianozsvald
0
100
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
The Limits of Empathy - UXLibs8
cassininazir
1
220
How STYLIGHT went responsive
nonsquared
100
6k
Transcript
2018/04/12 Otemachi.rb#5 has_one :through Shu OGAWARA (@expajp)
35* n /$ .(@expajp) – &' • 3!2! –
Ruby/Rails210, – -+ – )1#"%( – 6+4
1 1 n
n
1 1 n
n
1 1 n
n has_many :through
1 1 n
n has_one :through has_many :through
has_many :through has_ many belongs_ to
has_ many belongs_ to
has_one :through has_ one belongs_ to
has_ one belongs_ to
Matter Contact User
n N+1 Query n
n matter.main_operator
scope n ' n 1"&
# %)!( n $
has_one :through n through
has_one :through n through
has_one :through n through " ! n
conditions -> { where(…) } #
n ## $( $ % n has_one :through &%!
" n ' $