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
5分でわかるAdequateRecord
Search
Tomohiro MITSUMUNE
October 31, 2014
Programming
1
460
5分でわかるAdequateRecord
#dena_rubykaigi01 LT資料
Tomohiro MITSUMUNE
October 31, 2014
Tweet
Share
More Decks by Tomohiro MITSUMUNE
See All by Tomohiro MITSUMUNE
某サービスのリニューアルでECSを導入したよもやま話
tmitz
1
2.6k
Swift2 New Features
tmitz
0
130
Other Decks in Programming
See All in Programming
Better Code Design in PHP
afilina
PRO
0
130
cmp.Or に感動した
otakakot
3
200
flutterkaigi_2024.pdf
kyoheig3
0
150
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
230
CSC509 Lecture 09
javiergs
PRO
0
140
距離関数を極める! / SESSIONS 2024
gam0022
0
290
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Jakarta EE meets AI
ivargrimstad
0
670
Ethereum_.pdf
nekomatu
0
460
C++でシェーダを書く
fadis
6
4.1k
Amazon Qを使ってIaCを触ろう!
maruto
0
410
Realtime API 入門
riofujimon
0
150
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
A Philosophy of Restraint
colly
203
16k
RailsConf 2023
tenderlove
29
900
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
GitHub's CSS Performance
jonrohan
1030
460k
Writing Fast Ruby
sferik
627
61k
How GitHub (no longer) Works
holman
310
140k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Transcript
5ͰΘ͔Δ AdequateRecord @t_mitz
࠷ॳʹ
"[VTBUIFNF ͔ͿΓ͗͢Ͱ͢ ਓ IUUQTHJUIVCDPNTBOPHSBQIJYB[VTBLFZOPUF
2"EFRVBUF3FDPSE JTԿ
"3BJMTͰՃ͞ΕΔ .BKPS'FBUVSFTͷͭ
Rails 4.2ͷMajor Features • ActiveJob • AdequateRecord • Web Console
• Foreign key support
ݱࡏɺCFUB ͋ͨΓʹຊϦϦʔε͞Εͦ͏
ͱࡢॻ͍ͨΒ ຊCFUBϦϦʔε ͞Εͯ·ͨ͠ IUUQXFCMPHSVCZPOSBJMTPSH3BJMT CFUBIBTCFFOSFMFBTFE
ؓٳ
–Rails 4.2 Release Notes “Adequate Record is a set of
refactorings that make Active Record find and find_by methods and some association queries upto 2x faster.”
ࡶʹ༁͢ͱ
lϦϑΝΫλϦϯάͰ "DUJWF3FDPSEΛ ഒͨͥ͘͠ʂz
None
lਪଌ͢ΔͳܭଌͤΑz ͷֶʹج͖ͮϕϯνϚʔΫ
IUUQUFOEFSMPWFNBLJOHDPN BEFRVBUFSFDPSEQSPMJLFBDUJWFSFDPSEIUNM
3BJMT 3BJMTCFUB
ϗϯτʹ ഒʂʂʂ
੍͕͋Γ·͢
OK Query Article.find 1 Article.find_by_title ‘foobar’ ! article
= Article.find 2 article.comments
NG Query Article.where(title: ‘foobar’)
.where(user: 1) ! Article.find(1, 2, 3) ! Article.find_by ‘published_at < ?’, 2.weeks.ago
ҰମͲ͏ͬͯ ͯ͘͠Δͷ͔
None
IUUQUFOEFSMPWFNBLJOHDPN BEFRVBUFSFDPSEQSPMJLFBDUJWFSFDPSEIUNM
42-4USJOHͷ 5SBOTGPSNΛຖճͤͣ Ωϟογϡͯ͠ߴԽ
ಥવͷ ίʔυϦʔσΟϯά
;ΉɺCSBODI͕͋ΔΒ͍͠ http://tenderlovemaking.com/2014/02/19/adequaterecord- pro-like-activerecord.html
None
ແ͍͠ʂʂʂ
NBTUFSʹNFSHF͞Εͨͷ ͰEFMFUF͞Ε͍ͯ·ͨ͠
DPNNJUMPH͔ΒͦΕΆ͍࣮ Λ୳͢͜ͱํʹมߋ
͕Ή͠ΌΒʹίʔυͬͯ ͭΒ͍ͷͰώϯτ୳͠
;Ήɺ3BJMTϦϦʔεͨ͠ޙʹ NFSHF͢Δએݴ http://tenderlovemaking.com/2014/02/19/adequaterecord- pro-like-activerecord.html
Rails 4.1 Released 2014/04/08 IUUQXFCMPHSVCZPOSBJMTPSH3BJMT
IUUQTHJUIVCDPNSBJMTSBJMTDPNNJUTNBTUFS BDUJWFSFDPSE QBHFBVUIPSUFOEFSMPWF
ϦϦʔεʹ NFSHFͯͨ͆͠
None
"DUJWF3FDPSE4UBUFNFOU $BDIFͰΩϟογϡੜͯ͠Δ Έ͍ͨͰ͢Ͷ
ৄ͘͜͠ͷ͋ͨΓͷίʔυ • https://github.com/rails/rails/blob/master/ activerecord/lib/active_record/core.rb • https://github.com/rails/rails/blob/master/ activerecord/lib/active_record/ statement_cache.rb • https://github.com/rails/rails/blob/master/
activerecord/test/cases/statement_cache_test.rb
ͪͳΉͱ"34UBUFNFOU$BDIF ͷςετέʔεʹKPJOXIFSFͰ Ωϟογϡੜͷςετ͕͋ΔͷͰɺ কདྷpOEܥ౷Ҏ֎ վળ͞ΕΔ͔͠Εͳ͍
TL;DR
ಛʹؾʹ͠ͳͯ͘ ͔ΒpOEܥ͕ഒ
Enjoy Rails way!!!