Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
【2018/04/12 Otemachi.rb#5】has_one :throughの憂鬱
Search
Shu OGAWARA
April 12, 2018
Technology
0
410
【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
入門 FormObject / An Introduction to FormObject #kaigionrails
expajp
2
4.5k
あなたの「仮説検証」、ゆがんでいませんか? / Isn't Your "Hypothesis Verification" Distorted? #emoasis
expajp
2
420
Rubyはなぜ「たのしい」のか? / Why is Ruby a programmers' best friend? #tqrk15
expajp
5
2.1k
エンジニアリングマネージャーはどう学んでいくのか #devsumi / How Do Engineering Managers Continue to Learn and Grow?
expajp
8
5.5k
RubyKaigi参加歴をふりかえる / Looking Back on My RubyKaigi Participation History #kaigieffectLT
expajp
3
530
わたしのメタ学習 / My Own Meta Learning #shinjukurb
expajp
0
470
ActiveSupport::Concernで開くメタプログラミングの扉 #heiseirubykaigi / The door of meta-programing is opened by ActiveSupport::Concern
expajp
1
2.3k
実践Railsアプリケーション設計 #meetup_rails / Practical Rails Application Design
expajp
4
40k
【2019/07/06 TamaRuby会議01】brainf*ck処理系で理解するパターンマッチングをつかった疎結合な実装
expajp
2
2.7k
Other Decks in Technology
See All in Technology
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
970
小規模チームによる衛星管制システムの開発とスケーラビリティの実現
sankichi92
0
150
Flutter Thread Merge - Flutter Tokyo #11
itsmedreamwalker
1
110
『星の世界の地図の話: Google Sky MapをAI Agentでよみがえらせる』 - Google Developers DevFest Tokyo 2025
taniiicom
0
430
AI エージェントを評価するための温故知新と Spec Driven Evaluation
icoxfog417
PRO
2
960
Eight Engineering Unit 紹介資料
sansan33
PRO
0
5.6k
AI エージェント活用のベストプラクティスと今後の課題
asei
2
390
Digital omtanke på Internetdagarna 2025
axbom
PRO
0
140
今すぐGoogle Antigravityを触りましょう
rfdnxbro
0
230
クラスタ統合リアーキテクチャ全貌~1,000万ユーザーのウェルネスSaaSを再設計~
hacomono
PRO
0
210
履歴テーブル、今回はこう作りました 〜 Delegated Types編 〜 / How We Built Our History Table This Time — With Delegated Types
moznion
6
5k
Codeer.LowCode.Blazor 紹介と成長録
wadawada
0
100
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
34
2.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
Building Applications with DynamoDB
mza
96
6.8k
Producing Creativity
orderedlist
PRO
348
40k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.8k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
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 ' $