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/09/18 Otemachi.rb#9】君(退会したユーザ)の名は。
Search
Shu OGAWARA
September 18, 2018
Technology
0
530
【2018/09/18 Otemachi.rb#9】君(退会したユーザ)の名は。
2018/09/18のOtemachi.rb#9での発表資料です。久しぶりのRailsネタです。
Shu OGAWARA
September 18, 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.5k
あなたの「仮説検証」、ゆがんでいませんか? / Isn't Your "Hypothesis Verification" Distorted? #emoasis
expajp
2
440
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
550
わたしのメタ学習 / My Own Meta Learning #shinjukurb
expajp
0
490
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精度改善の優先順位づけ
zerebom
0
440
SREの仕事を自動化する際にやっておきたい5つのポイント
jacopen
6
1.2k
あたらしい上流工程の形。 0日導入からはじめるAI駆動PM
kumaiu
4
600
Regional_NAT_Gatewayについて_basicとの違い_試した内容スケールアウト_インについて_IPv6_dual_networkでの使い分けなど.pdf
cloudevcode
1
200
ファインディの横断SREがTakumi byGMOと取り組む、セキュリティと開発スピードの両立
rvirus0817
1
600
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
1
260
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
0
140
全員が「作り手」になる。職能の壁を溶かすプロトタイプ開発。
hokuo
1
640
書籍執筆での生成AIの活用
sat
PRO
1
240
Amazon ElastiCacheのコスト最適化を考える/Elasticache Cost Optimization
quiver
0
330
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8k
Marketing to machines
jonoalderson
1
4.6k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
87
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
260
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
280
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
150
How to make the Groovebox
asonas
2
1.9k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
130
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
52k
It's Worth the Effort
3n
188
29k
Transcript
܅ ͷ ໊ ɻ ୀձͨ͠Ϣʔβ 0UFNBDIJSC 4IV0("8"3" !FYQBKQ 1IPUPCZ/FJM3PTFOTUFDI
PO6OTQMBTI
1 !
Rails
n & %(@expajp) – ! – 3
– Ruby/Rails(1 • Project Euler 100 • Vue.js+ – # ' " – *$ )
CM
View
n post creatornil
n post
n DB posts ! user_id NULL " 0 #
n post
n DB posts ! user_id NULL " 0 #
,
n B83+,.02@A' " % – ,.020 ;E(15*,47<: $#D=
n View6-/)'C9 ? " % &" – View!6-/)'? – DRY>%
n & #$ n
'!" %
N+1
N+1 Q . L S 0 N Q . 11
N+1 / Eager Loading - Rails Webook https://ruby-rails.hatenadiary.com/entry/20141108/1415418367 ’’
N+1 n DB
→
٫Լʂ
CTO
n Active Record/. creator_id0 - * n Decorator,#4(
*&!)$+ " → post'%*&!)30$+ → DRY21
Active Record
Decorator
View
ҟٞ͋Γʂ
CH*-&0c$a2&16$ >TO@L&Kg\N MB/&K$ ;5&F Z$ [Ra2 VI% 43$QWU *-&P
D$a2Gb# $ $ SY9X`d$=^!A]?(.+'),JE" $a2&<7:f_<$ The WyCash Portfolio Management System http://c2.com/doc/oopsla92.html heSY8TO - Wikipedia ’’
n 06:?)<5DE n Decorator7*F2(> +' -4@1% –
"#! . n gem9(,38C – B/) & ;A3 $/=
NullUser, SystemUser
n Decorator Post creator n User
full_name n Post NullUser, SystemUser – full_name ! n creator User, NullUser, SystemUser
User
NullUser, SystemUser
Post
!
n DB5-6 & %!* #($). –
View,1 '! n 70+4 "*/ 32
n )$ " !'( n
View#*%&
1. 2.
3. NullUser, SystemUser
!
n ;&B5$ – ?< 12$'*/+-@ – full_nameA03 %
n ;D …… – 89" FE – DRY" n ;&,(-.4=6,). C :$# >7 !
n (#&')!% #@ n Rails0-= – *"$!,E?28DRYF<251A
– I74C>6 n +3D 9:HJ;B – /.G+3D