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
Recent Rails movements in 15 minutes
Search
Masafumi Okura
February 24, 2021
Programming
0
110
Recent Rails movements in 15 minutes
Ruby on Rails及びその周辺技術は2021年になっても進化を続けています。特に近年は複数DB周りとフロントエンド関係で変化が顕著です。この発表ではそれらをまとめてご紹介します。
Masafumi Okura
February 24, 2021
Tweet
Share
More Decks by Masafumi Okura
See All by Masafumi Okura
Why did my proposals get rejected?
okuramasafumi
1
440
A suggestion for the future of RDoc
okuramasafumi
1
66
15 JSON serializers for Ruby
okuramasafumi
2
110
Tech Events, Should We See Them from the Outside or the Inside?
okuramasafumi
1
39
Creating gems 101
okuramasafumi
1
82
How NOT to make your DSL terrible
okuramasafumi
0
280
オブジェクトしこう
okuramasafumi
2
210
Debugging Alba
okuramasafumi
1
190
Learning Ruby
okuramasafumi
5
560
Other Decks in Programming
See All in Programming
cmp.Or に感動した
otakakot
2
130
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Hotwire or React? ~アフタートーク・本編に含めなかった話~ / Hotwire or React? after talk
harunatsujita
1
120
Jakarta EE meets AI
ivargrimstad
0
600
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
最新TCAキャッチアップ
0si43
0
140
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.4k
Arm移行タイムアタック
qnighy
0
320
Jakarta EE meets AI
ivargrimstad
0
530
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
580
Featured
See All Featured
Code Review Best Practice
trishagee
64
17k
Faster Mobile Websites
deanohume
305
30k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Statistics for Hackers
jakevdp
796
220k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
A Philosophy of Restraint
colly
203
16k
Transcript
࠷ۙͷRailsࣄΛ15Ͱ͓͞ Β͍ ୈ28ճΏΔͪ.it OKURA Masafumi, 2021-02-24
ࣗݾհ • ໊લɿେխ࢙ʢ͓͓͘Β·͞;Έʣ • ॴଐɿϑϦʔϥϯε • ಘҙɿRubyͱRuby on Railsɺͪΐͬ͜ͱVim •
՝֎׆ಈɿ֤छొஃɺίϛϡχςΟӡӦʢܭ4ͭʣɺΧϯϑΝϨϯε ӡӦʢKaigi on RailsʣɺOSSʢgemΛܭ8ͭʣ
15
ࠓ͢͜ͱ • Rails 6.1Ͱೖͬͨػೳ • ߋʹਐΜͩෳDBରԠ • ActiveModel::ErrorͷΦϒδΣΫτԽ • etc.
• HotwireͱTurbo • StimulusReflexपล
ࠓͷτʔΫ୭͚ʁ • ࠷ۙRailsΛ͋·Γ৮͍ͬͯͳ͍ਓ • RailsΛ৽نҊ݅Ͱ࠾༻͠Α͏͔໎͍ͬͯΔਓ • RailsͱϑϩϯτΤϯυͷؔੑʹ͍ͭͯΓ͍ͨਓ
Rails 6.1
Rails 6.1 • 202012݄ϦϦʔε • ۄػೳਫฏγϟʔσΟϯάͳͲͷෳDBରԠ • ActiveModel::Errorؔͷඇޓͳมߋ • ࡉ͔ͳվྑ
Rails 6.1ʹ͓͚ΔෳDBରԠ • 6.0ͰύʔςΟγϣχϯά͕αϙʔτ͞Εͨ • 6.1ͰਫฏγϟʔσΟϯάαϙʔτ͞Εɺ͞Βʹศརʹ • Ϟσϧ͝ͱʹҟͳΔDBʹଓ͢Δ͜ͱՄೳʹ
ActiveModel::ErrorͷՃ • ैདྷ@model.errorsϝιουΤϥʔใؚ͕·ΕͨϋογϡΛฦ ͍͕ͯͨ͠ɺϋογϡͩͱѻ͍ͮΒ͞σʔλഁଛͷݒ೦͋ͬͨ • 6.1͔Βɺ@model.errorsϝιουActiveModel::ErrorΦϒδΣΫ τͷྻΛฦ͢Α͏ʹͳͬͨ • ৄࡉ https://youtu.be/FGhZR4ns_tc
ʢKaigi on RailsͰͷ࣮ऀͷ ൃදʣΛࢀর
࣍7.0ʹͳͬͨ • https://github.com/rails/rails/commit/ 1b455e2e9d6937d4107e19cb32e2f98aa08886b9 • ͳΜ͔Ͱ͔͍มߋ͕ೖΔΒ͍͠ʂ
Hotwire
Hotwire • https://hotwire.dev/ • RailsͷΦϦδφϧαʔϏεͰ͋ΔBasecampͷਓ͕ͨͪ࡞ͬͨɺ HTML Over The WireͷΦʔϓϯιʔε࣮ •
Heyͱ͍͏ϝʔϧαʔϏεͰ࣮ઓೖࡁΈ • TurboɺStimulusɺStradaͷ3ͭͷίϯϙʔωϯτͰߏ͞ΕΔ • ଞݴޠͩͱLivewireLiveviewͱݺΕΔͷ͕ࣅ͍ͯΔΒ͍͠
Turbo • JavaScriptͷهड़ྔΛ࠷খݶʹͭͭ͠ϢʔβʔମݧΛ্ͤ͞ΔͨΊ ͷϥΠϒϥϦ • DriveɺFramesɺStreamsɺNativeͷ4ͭͷίϯϙʔωϯτͰߏ͞Ε Δ • ͋Μ·ΓͪΌΜͱ৮Εͯͳ͍ͷͰղઆͰ͖ͳ͍…
Stimulus • ܰྔͳJavaScriptϑϨʔϜϫʔΫ • TurboͰΓͳ͍ͱ͖ʹStimulusͰJSΛॻ͘ɺͱ͍͏ΠϝʔδΒ͠ ͍ • CoCʢઃఆΑΓنʣͷΑ͏ͳRailsͬΆ͍Ξϓϩʔν͕ಛ
Strada • ະϦϦʔε • ϞόΠϧΞϓϦʹؔΘΔͷΒ͍͠
StimulusReflex
StimulusReflexʢҎԼ”SR”ʣ • https://docs.stimulusreflex.com/ • Hopsoftͱ͍͏ਓ͕ϝΠϯͰ։ൃ͍ͯ͠ΔΦʔϓϯιʔεͷRails͚ ϥΠϒϥϦ • WebSocketΛ׆༻ͯ͠HTMLΛॻ͖͑Δ • SPAͬΆ͍ΞϓϦΛJSΛॻ͔ͣʹ࡞ΕΔ͕ɺStimulusʹґଘ͍ͯ͠Δ
• Djangoͱ͔Ͱಈ͔͍ͯ͠Δਓ͍ΔΒ͍͠…ʁ
༨ஊ • SRΛ͍20ͰTwitterͬΆ͍ΞϓϦΛ࡞ΔϥΠϒίʔσΟϯά͕ۜ ࠲Rails#27ͰߦΘΕͨʢhttps://ginza-rails.connpass.com/event/ 193008/ʣ • ؆୯ͳը໘ಉظΛ࣮͍͚ͨͩ͠ͳΒ͜ΕͰेͰͱ͍͏࣮ײ • SRίϛϡχςΟ͕׆ൃʢDiscord1000ਓ͑ʂʣ •
࡞ऀ͔Βαϙʔτͯ͠Β͑Δ͔ʁ
पลٕज़ • CableReadyɿSRͷج൫ɺWebSocketʹσʔλΛྲྀ͠ࠐΉ • FuturismɿRailsͷύʔγϟϧΛActionCableͰඇಉظͰϨϯμʔ͢Δ • OptimismɿRailsͷόϦσʔγϣϯͱΤϥʔͷϨϯμϦϯάΛϦΞϧ λΠϜͰߦ͏ • ViewComponentReflexɿViewComponentͱ͍͏GitHubࣾʹΑΔ
ϏϡʔίϯϙʔωϯτϑϨʔϜϫʔΫͱSRΛΈ߹ΘͤͨϥΠϒϥϦ
HotwireͱSR͔Ϳͬͯͳ͍ʁ
͔ͿͬͯΔʂ
HotwireͱSRͷকདྷͲ͏ͳΔͷ͔ • Θ͔ΒΜʂ • HotwireActiveRecordͷCRUDίʔϧόοΫͱͷ૬ੑ͕ྑ͍ͷͱγ ϯϓϧͳͷ͕ڧΈͬΆ͍ • SRMorphͱ͍͏֓೦ʹΑΓԠ༻ൣғΛ͍͛ͯΔҹ • ͕ͬͭΓ͍ൺͯΈͨΘ͚Ͱͳ͍ͷͰݟ͕΄͍͠ͱ͜Ζ
·ͱΊ
Rails 6.1 • ෳDBରԠ͔ͳΓਐΜͩ • ErrorपΓͷඇޓʹҙ • ࣍Rails 7!
HotwireͱSR • ͲͪΒRailsϝΠϯʢগͳ͍JSʣͰSPAͬΆ͍ΞϓϦΛ࣮ݱ͢ΔͨΊ ͷπʔϧ • ࠓޙɺ྆ํ͕ྲྀߦΔͷ͔ɺͲͪΒ͔͕γΣΞΛऔΔͷ͔ɺͲͪΒ ΘΕͳ͍ͷ͔ɺ·ͩ୭ʹΘ͔Βͳ͍ • ؾʹͳΔਓཁνΣοΫͩʂ