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
Rails 6.0 Action Mailboxについて
Search
horikawa
May 15, 2019
Programming
0
390
Rails 6.0 Action Mailboxについて
otemachi.rb#17で発表した資料
horikawa
May 15, 2019
Tweet
Share
More Decks by horikawa
See All by horikawa
Caching associations in rails
casix
1
320
Create Action Mailbox Sample Application
casix
1
380
Rails 4.2→5.2アップデート
casix
0
440
Other Decks in Programming
See All in Programming
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
260
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
490
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
130
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
Google Opalで使える37のライブラリ
mickey_kubo
2
110
実践Claude Code:20の失敗から学ぶAIペアプログラミング
takedatakashi
15
6.1k
CSC305 Lecture 06
javiergs
PRO
0
250
Leading Effective Engineering Teams in the AI Era
addyosmani
7
500
大規模アプリのDIフレームワーク刷新戦略 ~過去最大規模の並行開発を止めずにアプリ全体に導入するまで~
mot_techtalk
1
470
XP, Testing and ninja testing ZOZ5
m_seki
3
750
Software Architecture
hschwentner
6
2.3k
CSC509 Lecture 03
javiergs
PRO
0
340
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.7k
Building an army of robots
kneath
306
46k
Designing for Performance
lara
610
69k
Side Projects
sachag
455
43k
BBQ
matthewcrist
89
9.8k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
980
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
10
880
Docker and Python
trallard
46
3.6k
Code Review Best Practice
trishagee
72
19k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
61k
How to train your dragon (web standard)
notwaldorf
97
6.3k
Transcript
Rails 6.0ͷ Action Mailbox גࣜձࣾπΫϧόɹαʔόαΠυΤϯδχΞ ງɹ@CASIXx1
• ීஈʮcowcamoʯͱ͍͏ΞϓϦΛ։ൃͯ͠ ·͢ • αʔόαΠυɺRailsʢ5.2ʣΛͬͯ·͢
Rails 6.0.0͕ͦΖͦΖग़ͦ͏ʂ
Rails 6.0.0.rc1͕ग़͍ͯΔͷ Ͱɺ΄΅6.0ͷػೳࢼͤΔʂ
৭ʑՃ͞Ε͍ͯΔ
Rails 6.0ͷओཁՃػೳ • Action Text • Action Mailbox • Multiple
Databases • Parallel Testing • Zeitwerk...etc
Action Textͷ ฉ͚͘Ͳɺɺ
Action Mailboxͷฉ͔ͳ͍...
Action Mailboxͷ͜ͱΛ ௐͯΈ·ͨ͠ ʢ·్ͩத·Ͱ͔͠ ࢼͤͯͳ͍ ʣ
ݩʑɺผͷgemͱ࣮ͯ͠͞Ε ͍ͯͨ
Rails 5.2Ͱ͑ͦ͏???
Action Mailboxͷػೳ • ड৴ϝʔϧʹରͯ͠ɺʮRailsʯͰɺॲཧ͢Δʂ • DBS3ʹอଘͨ͠ΓɺAction MailerΛͬͯɺ ࣗಈฦ৴ͨ͠Γ…
4FOE(SJE Ϣʔβʔ ϝʔϧૹ৴ RailsʹHTTP Post ɹ3BJMT "DUJPO.BJMCPY ॲཧ %# อଘ
4
ॳظઃఆ • $ rails action_mailbox:install • ApplicationMailboxΫϥε͕ੜ͞ΕΔ • MailboxΛ֨ೲ͢Δςʔϒϧ͕ੜ͞ΕΔ
app/mailboxes/application_mailbox.rb class ApplicationMailbox < ActionMailbox::Base #
[email protected]
Ѽͷϝʔϧ # ForwardsMailboxΫϥεͰɺॲཧΛߦ͏ routing
/^save@/i => :forwards #
[email protected]
Ѽͷϝʔϧ # RepliesMailboxΫϥεͰɺॲཧΛߦ͏ routing /@replies\./i => :replies end
ϝʔϧɺInboundEmailϞσ ϧͱͯ͠ѻΘΕΔ • class InboundEmail < ActiveRecord::Base • https://github.com/rails/rails/blob/ master/actionmailbox/app/models/
action_mailbox/inbound_email.rb • ActiveStorageͱࣅͨΑ͏ͳײ͡??
SMTPड͚ೖΕઃఆ • config/environments/֤ڥ.rb config.action_mailbox.ingress = # ͜͜ʹαʔϏε໊ # sendgridͷ߹ config.action_mailbox.ingress
= :sendgrid # mailgunͷ߹ config.action_mailbox.ingress = :mailgun # exam, mailgun, mandrill, postfix, postmark, qmail, sendgridΛαϙʔτ͍ͯ͠Δ
ύεϫʔυઃఆ • SendGridͳͲͷϝʔϧαʔϏεͱͷ࿈ܞͰɺ ύεϫʔυ͕ٻΊΒΕΔͷͰɺ ڥม or CredentialͰύεϫʔυΛ RailsଆͰઃఆ͓ͯ͘͠
ϝʔϧαʔϏεଆͷઃఆ ྫɿSendGrid SendGrid͔ΒɺHTTP POSTͯ͠Β͏ʂ https://actionmailbox:password@domain/rails/ action_mailbox/sendgrid/inbound_emails
ศརͳҹ • RspecͳͲͰͷςετॻ͚Δ • ActiveStorageΛ͑ɺS3ͳͲʹอଘͰ͖ΔΒ͠ ͍ • Callbackग़དྷͦ͏ • https://github.com/rails/rails/blob/master/
actionmailbox/lib/action_mailbox/callbacks.rb
ؾʹͳͬͨՕॴ • ϝʔϧαʔϏεଆͷઃఆඞཁʹͳΔ • SendGridͳΒɺInbound ParseͳͲ • Parseͷ༷ཧղ͓͔ͯ͠ͳ͍ͱ͍͚ͳ͍ • SESɺRails
6.1͔ΒͷαϙʔτͱͳΓͦ͏ • https://github.com/rails/rails/commit/ f480cfabcd9000b5817b610e21466299025b12d2 • ެࣜඇެࣜͷυΩϡϝϯτ͕ඇৗʹগͳ͍… • ϝʔϧେྔʹདྷͨΒɺαʔόͲ͏ͳΔͷ͔ͳ…
·ͱΊ
·ͱΊ • Rails AppͰ࿈ܞ͕ඞཁͳ߹ɺॏๅͦ͠ ͏ʂ • ֤ཧऀʹϝʔϧΛసૹͨ͠Γ • ࿈ܞ͕ཁΒͳ͍߹ɺAction Mailbox୯ମ
ͰαʔόཱͯΕྑ͍ؾ…
ऴΘΓ
ࢀߟ • Action Mailbox gem • https://github.com/rails/actionmailbox/tree/master • Rails Guides
• https://edgeguides.rubyonrails.org/ action_mailbox_basics.html • bagelee • https://bagelee.com/programming/ruby-on-rails/rails6- action-mailbox/