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
初めてのPadrino
Search
Takeshi Yabe
December 11, 2014
Technology
3
910
初めてのPadrino
日本OSS推進フォーラム主催 第4回アプリケーション部会勉強会 での発表資料
Takeshi Yabe
December 11, 2014
Tweet
Share
More Decks by Takeshi Yabe
See All by Takeshi Yabe
Rails Girls Kagoshima 1st スポンサーLT
tyabe
1
120
STORES.jp 開発組織の軌跡 / Rails Developers Meetup 2018 Day4
tyabe
1
750
ImageFlux x STORES.jp
tyabe
0
2.9k
STORES.jp開発チームのこれまでとこれから
tyabe
0
540
Yokohama.rb Monthly Meetup #50
tyabe
1
530
RubyKaja 2014
tyabe
0
310
Favorite points of Padrino
tyabe
0
100
「eye」でカジュアルにプロセス監視
tyabe
0
51
PadrinoDecorator
tyabe
0
52
Other Decks in Technology
See All in Technology
私なりのAIのご紹介 [2024年版]
qt_luigi
1
120
.NET 9 のパフォーマンス改善
nenonaninu
0
1k
社外コミュニティで学び社内に活かす共に学ぶプロジェクトの実践/backlogworld2024
nishiuma
0
270
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
Turing × atmaCup #18 - 1st Place Solution
hakubishin3
0
490
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
200
Oracle Cloudの生成AIサービスって実際どこまで使えるの? エンジニア目線で試してみた
minorun365
PRO
4
280
小学3年生夏休みの自由研究「夏休みに Copilot で遊んでみた」
taichinakamura
0
170
Qiita埋め込み用スライド
naoki_0531
0
5.1k
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
230
日本版とグローバル版のモバイルアプリ統合の開発の裏側と今後の展望
miichan
1
130
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
17
14k
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
298
20k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Practical Orchestrator
shlominoach
186
10k
Building an army of robots
kneath
302
44k
The Cost Of JavaScript in 2023
addyosmani
45
7k
GraphQLとの向き合い方2022年版
quramy
44
13k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
A designer walks into a library…
pauljervisheath
204
24k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
32
2.7k
Transcript
ॳΊͯͷ1BESJOP ʙ1BESJOPΛར༻ͨ͠8&#ΞϓϦέʔγϣϯ࡞ํ๏ͷհʙ ຊ044ਪਐϑΥʔϥϜओ࠵ ୈ̐ճΞϓϦέʔγϣϯ෦ձษڧձ ݄ 5BLFTIJ:BCF !UZBCF
͓͢Δ͜ͱ w ࣗݾհ w ୈ෦1BESJOP֓ཁ w ୈ෦1BESJOPΛͬͨ։ൃͷ࣮ફ
5BLFTIJ:BCF !UZBCF ΞϓϦέʔγϣϯΤϯδχΞ ओͳ୲αʔόαΠυ :PLPIBNBSC 4IJCVZBSC
1BESJOPͱͷग़ձ͍ࠒ
None
None
None
ୈ෦ 1BESJOP֓ཁ 1BESJOPͱͲ͏͍ͬͨͷ͔ʢྺ࢙ɾಛʣΛઆ໌ͭͭ͠ɺ 1BESJOPΞʔΩςΫνϟͷ֓આɺಛతػೳΛઆ໌͠·͢ɻ
1BESJOPͱ 3VCZͷ8FCΞϓϦέʔγϣϯϑϨʔϜϫʔΫ 8FCΞϓϦέʔγϣϯΛखૣ͘࡞ΔͨΊͷ%4-Ͱ͋Δ 4JOBUSBͷίʔυͱઃܭࢥΛϕʔεʹɺ 8FCΞϓϦέʔγϣϯ։ൃͰΑ͘ΘΕΔͰ͋Ζ͏ ϥΠϒϥϦϔϧύʔϝιουͳͲΛՃ͢Δ͜ͱͰɺ ෳࡶͳ8FCΞϓϦέʔγϣϯ։ൃͰ ར༻ՄೳͳΑ͏ʹ͢Δ͜ͱΛతͱ͍ͯ͠Δ
1BESJOPͱ
1BESJOPͱ 1BESJOPΠλϦΞޠɺӳޠͩͱ(PEGBUIFS lγφτϥzͰ࡞ΒΕ͍ͯΔ͔ΒΒ͍͠ʜ
1BESJOPͱ 4JOBUSBϕʔε ίʔυ͚ͩͰͳ͘ઃܭํ ͏ͱ͖ίϨ͕؊ཁ
None
4JOBUSB 4JOBUSBϑϨʔϜϫʔΫͰͳ͘ɺ 8FCΞϓϦέʔγϣϯ 3BDLΞϓϦέʔγϣϯ Λ खૣ͘؆୯ʹهड़͢ΔͨΊͷ%4- l4JOBUSBJTB%4-GPSRVJDLMZ DSFBUJOHXFCBQQMJDBUJPOTJO3VCZ XJUINJOJNBMF⒎PSUz IUUQXXXTJOBUSBSCDPNJOUSPΑΓҾ༻
ΫϥγοΫελΠϧ 1 require 'sinatra' 2 3 get '/' do 4
"Hello, sinatra!" 5 end ϞδϡϥʔελΠϧ 1 require 'sinatra/base' 2 3 class App < Sinatra::Base 4 get '/' do 5 "Hello, world!" 6 end 7 end ୯ମͰ͏γϯϓϧͳΞϓϦͳΒΫϥγοΫελΠϧ ଞͷ3BDLΞϓϦͱҰॹʹ͏ͳΒϞδϡϥʔελΠϧ 4JOBUSB
4JOBUSB ؆ܿͰ͋Δ͜ͱ ෳࡶੑඞཁʹͳͬͨͱ͖ʹՃ
4JOBUSB γϯϓϧ ͚ͩͲʜ
NZQSPKFDU ᵓᴷᴷ(FNpMF ᵓᴷᴷ(FNpMFMPDL ᵓᴷᴷ3BLFpMF ᵓᴷᴷBQQSC ᵓᴷᴷDPOpH ᴹᵋᴷᴷEBUBCBTFSC ᵓᴷᴷDPOpHSV ᵓᴷᴷEC ᴹᵋᴷᴷEFWFMPQNFOUEC
ᵓᴷᴷMPH ᴹᵋᴷᴷEFWFMPQNFOUMPH ᵓᴷᴷNBJMFSSC ᵓᴷᴷQVCMJD ᴹᵓᴷᴷKBWBTDSJQUT ᴹᴹᵋᴷᴷBQQKT ᴹᵋᴷᴷTUZMFTIFFUT ᴹᵋᴷᴷBQQDTT ᵋᴷᴷWJFXT ᵓᴷᴷJOEFYTMJN ᵋᴷᴷMBZPVUTMJN σΟϨΫτϦߏ %#ͷઃఆ ϩάͷઃఆ ϔϧύʔϝιου )5.-Τεέʔϓ ηογϣϯ ςετڥ ίϯιʔϧͰͷಈ࡞֬ೝ 3BLFλεΫ ͳͲͳͲ ָ͍ͨ͠ 4JOBUSB
None
1BESJOPͷྺ࢙ TJOBUSB@NPSFͷ։ൃ͕ελʔτ QBESJOPͷ։ൃ͕ελʔτ TJOBUSB@NPSF͕QBESJOPͷҠߦΛද໌ TJOBUSB@NPSF࠷ޙͷίϛοτ ʜ ຊਓ͕։ൃνʔϜೖΓ !OBNVTZBLB
ϦϦʔε 3VCZͷαϙʔτഇࢭͳͲେ͖Ίͷมߋ ϦϦʔε EZOBNPJEͷαϙʔτɺDBDIF@PCKFDUIFMQFSͷՃ ϦϦʔε 1BSBNT1SPUFDUJPOͷՃ ϦϦʔε SPVUFS SFMPBEFS HFOFSBUPSͷվળ ϦϦʔε NPVOUFS͕վળ͞Εɺଞͷ3BDLΞϓϦͷϚϯτ͕Մೳʹͳͬͨ OFTRVFOB͕ݸਓͰ։ൃ OFTRVFOBͱɺಉ྅ͩͬͨ %"EE:& BDIJVͰ։ൃ ৽͍͠ϧʔλʔ QFOESBHPO Λ։ൃ
1BESJOPͷར༻ऀ
1BESJOPͷओͳػೳ δΣωϨʔλؚΉίϚϯυϥΠϯπʔϧ αϒΞϓϦέʔγϣϯ ଞͷ3BDLΞϓϦέʔγϣϯͷϚϯτ ϧʔςΟϯάͷ֦ு
.7$ύλʔϯͷಋೖ ๛ͳϔϧύʔϝιου ؆୯ͳϝʔϧૹ৴ػೳ Ωϟογϡػೳ ࠃࡍԽػೳ ଞͷϥΠϒϥϦͱ࿈ܞՄೳͳϩΨʔ ։ൃ࣌ͷϦϩʔμʔ
1BESJOPͷߏ 1BESJOP'SBNFXPSL DPSF 4JOBUSB IFMQFST NBJMFST TVQQPSU HFO DBDIF BENJO
QBESJOPDPSF
QBESJOPDPSF 4JOBUSBΛ֦ுͨ͠ϕʔεΞϓϦέʔγϣϯ 1BESJOP'SBNFXPSLͷػೳΛશͯ͏͜ͱ͕Ͱ͖Δ # lib/padrino-core/application.rb 1 module Padrino 2 class
Application < Sinatra::Base 3 register Padrino::ApplicationSetup 4 register Padrino::Routing 5 register Padrino::ParamsProtection SFHJTUFSϝιουʹΑΔ4JOBUSB֦ுͷొ VTFϝιουʹΑΔ3BDLϛυϧΣΞͷొ
QBESJOPDPSF Ճ͞ΕΔओͳػೳ ϧʔςΟϯάͷ֦ு αϒΞϓϦέʔγϣϯͱͦͷଞͷ3BDLΞϓϦͷϚϯτػߏ ΦʔτϩʔυରσΟϨΫτϦͷઃఆ ֦ு͞ΕͨϩΨʔ
։ൃ༻ͷϦϩʔμʔ ίϚϯυϥΠϯπʔϧ TUBSU TUPQ HFOFSBUF DPOTPMF SVOOFS SBLF
QBESJOPDPSF Ճ͞ΕΔओͳػೳ ϧʔςΟϯάͷ֦ு αϒΞϓϦέʔγϣϯͱͦͷଞͷ3BDLΞϓϦͷϚϯτػߏ ΦʔτϩʔυରσΟϨΫτϦͷઃఆ ֦ு͞ΕͨϩΨʔ
։ൃ༻ͷϦϩʔμʔ ίϚϯυϥΠϯπʔϧ TUBSU TUPQ HFOFSBUF DPOTPMF SVOOFS SBLF
QBESJOPDPSF 1 SampleProject::App.controllers :posts do 2 get :index do 3
# url(:posts, :index) => "/posts" 4 render 'posts/index' 5 end 6 7 get :show, map: '/posts/:id' do 8 # url(:posts, :show, id: 5) => "/posts/5" 9 render 'posts/new' 10 end 11 end ϧʔςΟϯάͷ֦ுʢҰྫʣ ໊લ͖ϧʔτɺςϯϓϨʔτΤϯδϯͷࣗಈݕग़
QBESJOPDPSF ֦ு͞ΕͨϩΨʔ
QBESJOPHFO
- project - app - mailer - controller - helper
- model - migration - plugin - component - task - admin - admin_page QBESJOPHFO ৽͍͠1BESJOPϓϩδΣΫτͷ࡞࣌ طଘͷ1BESJOPϓϩδΣΫτ ؆୯ʹίʔυΛՃ͢Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΔ
QBESJOPHFO ৽͍͠1BESJOPϓϩδΣΫτͷ࡞࣌ طଘͷ1BESJOPϓϩδΣΫτ ؆୯ʹίʔυΛՃ͢Δ͜ͱ͕Ͱ͖ΔΑ͏ʹͳΔ - project - app - mailer
- controller - helper - model - migration - plugin - component - task - admin - admin_page
QBESJOPHFO ϓϩδΣΫτੜ Usage: padrino-gen project [name] [options] Options: -n, [--app=APP]
-b, [--bundle], [--no-bundle] -r, [--root=ROOT] [--dev], [--no-dev] -i, [--tiny], [--no-tiny] -l, [--lean], [--no-lean] -a, [--adapter=ADAPTER] -p, [--template=TEMPLATE] -g, [--gem], [--no-gem] [--migration-format=MIGRATION_FORMAT] -d, [--orm=ORM] -t, [--test=TEST] -m, [--mock=MOCK] -s, [--script=SCRIPT] -e, [--renderer=RENDERER] -c, [--stylesheet=STYLESHEET] QBESJOPϓϩδΣΫτͰ͏߹ QBESJOPHQSPKFDU
QBESJOPHFO ϓϩδΣΫτੜ 03.ɺσʔλϕʔεΞμϓλɺςϯϓϨʔτΤϯδϯɺ ςεςΟϯάϑϨʔϜϫʔΫɺϞοΫϥΠϒϥϦɺ ελΠϧγʔτΤϯδϯɺ+BWB4DSJQUϥΠϒϥϦ ඞཁͳͷ͚ͩΛબΜͰ͑Δ બͳͯ͘ྑ͍
QBESJOPHFO ϓϩδΣΫτੜ QBESJOPHQSPKFDUTBNQMF@QSPKFDU TBNQMF@QSPKFDU ᵓᴷᴷ(FNpMF ᵓᴷᴷ3BLFpMF ᵓᴷᴷBQQ ᴹᵓᴷᴷBQQSC ᴹᵓᴷᴷDPOUSPMMFST ᴹᵓᴷᴷIFMQFST
ᴹᵋᴷᴷWJFXT ᴹᵋᴷᴷMBZPVUT ᵓᴷᴷCJO ᴹᵋᴷᴷTBNQMF@QSPKFDU ᵓᴷᴷDPOpH ᴹᵓᴷᴷBQQTSC ᴹᵋᴷᴷCPPUSC ᵓᴷᴷDPOpHSV ᵓᴷᴷMPH ᵓᴷᴷQVCMJD ᴹᵓᴷᴷGBWJDPOJDP ᴹᵓᴷᴷJNBHFT ᴹᵓᴷᴷKBWBTDSJQUT ᴹᵋᴷᴷTUZMFTIFFUT ᵋᴷᴷUNQ EJSFDUPSJFT pMFT QBESJOPHQSPKFDUUJOZ@QSPKFDUUJOZ UJOZ@QSPKFDU ᵓᴷᴷ(FNpMF ᵓᴷᴷ3BLFpMF ᵓᴷᴷBQQ ᴹᵓᴷᴷBQQSC ᴹᵓᴷᴷDPOUSPMMFSTSC ᴹᵓᴷᴷIFMQFSTSC ᴹᵋᴷᴷNBJMFSTSC ᵓᴷᴷCJO ᴹᵋᴷᴷUJOZ@QSPKFDU ᵓᴷᴷDPOpH ᴹᵓᴷᴷBQQTSC ᴹᵋᴷᴷCPPUSC ᵓᴷᴷDPOpHSV ᵓᴷᴷMPH ᵓᴷᴷQVCMJD ᴹᵓᴷᴷGBWJDPOJDP ᴹᵓᴷᴷJNBHFT ᴹᵓᴷᴷKBWBTDSJQUT ᴹᵋᴷᴷTUZMFTIFFUT ᵋᴷᴷUNQ EJSFDUPSJFT pMFT
QBESJOPHFO ίϯϙʔωϯτͷՃ Usage: padrino-gen component [options] Options: -n, [--app=APP] -r,
[--root=ROOT] -a, [--adapter=ADAPTER] -d, [--orm=ORM] -t, [--test=TEST] -m, [--mock=MOCK] -s, [--script=SCRIPT] -e, [--renderer=RENDERER] -c, [--stylesheet=STYLESHEET] Description: padrino-gen component add components into a Padrino project Current Selected Components: orm none test none mock none script none renderer slim stylesheet none ඞཁʹͳͬͨͱ͖ʹ ඞཁͳͷΛՃͰ͖Δ
QBESJOPHFO αϒΞϓϦέʔγϣϯ αϒΞϓϦέʔγϣϯ ϞσϧϥΠϒϥϦΛڞ௨Ͱ͑Δ QBESJOPHBENJO QBESJOPHBQQBQJ TBNQMF@QSPKFDU ᵓᴷᴷBQQ ᴹᵓᴷᴷBQQSC ᴹᵓᴷᴷDPOUSPMMFST
ᴹᵓᴷᴷIFMQFST ᴹᵋᴷᴷWJFXT ᴹᵋᴷᴷMBZPVUT ᵓᴷᴷBENJO ᴹᵓᴷᴷBQQSC ᴹᵓᴷᴷDPOUSPMMFST ᴹᵓᴷᴷIFMQFST ᴹᵋᴷᴷWJFXT ᴹᵋᴷᴷMBZPVUT ᵓᴷᴷBQJ ᴹᵓᴷᴷBQQSC ᴹᵓᴷᴷDPOUSPMMFST ᴹᵓᴷᴷIFMQFST ᴹᵋᴷᴷWJFXT ᴹᵋᴷᴷMBZPVUT ᵋᴷᴷQVCMJD ᵓᴷᴷBENJO ᴹᵓᴷᴷJNBHFT ᴹᵓᴷᴷKBWBTDSJQUT ᴹᵋᴷᴷTUZMFTIFFUT ᵓᴷᴷGBWJDPOJDP ᵓᴷᴷJNBHFT ᵓᴷᴷKBWBTDSJQUT ᵋᴷᴷTUZMFTIFFUT # config/apps.rb 1 Padrino.mount('SampleProject::Admin') 2 .to('/admin') 3 Padrino.mount('SampleProject::Api') 4 .to('/') 5 .host("api.example.org") 6 Padrino.mount('SampleProject::App') 7 .to(‘/') ϚϯτͷઃఆͰɺҰகͤ͞Δύεϗετ໊ΛࢦఆͰ͖Δ
QBESJOPBENJO
QBESJOPBENJO Ϣʔβೝূ͖ͷཧΞϓϦ͕࡞Ͱ͖ΔΑ͏ʹͳΔ QBESJOPHBENJO
QBESJOPBENJO # config/apps.rb 1 Padrino.mount('SampleProject::Admin').to('/admin') 2 Padrino.mount('SampleProject::App').to('/') BENJO ᵓᴷᴷBQQSC ᵓᴷᴷDPOUSPMMFST
ᴹᵓᴷᴷBDDPVOUTSC ᴹᵓᴷᴷCBTFSC ᴹᵋᴷᴷTFTTJPOTSC ᵋᴷᴷWJFXT ᵓᴷᴷBDDPVOUT ᴹᵓᴷᴷ@GPSNTMJN ᴹᵓᴷᴷFEJUTMJN ᴹᵓᴷᴷJOEFYTMJN ᴹᵋᴷᴷOFXTMJN ᵓᴷᴷCBTF ᴹᵋᴷᴷJOEFYTMJN ᵓᴷᴷFSSPST ᴹᵓᴷᴷTMJN ᴹᵓᴷᴷTMJN ᴹᵋᴷᴷTMJN ᵓᴷᴷMBZPVUT ᴹᵓᴷᴷBQQMJDBUJPOTMJN ᴹᵋᴷᴷFSSPSTMJN ᵋᴷᴷTFTTJPOT ᵋᴷᴷOFXTMJN EJSFDUPSJFT pMFT ཧΞϓϦαϒΞϓϦέʔγϣϯͱͯ͠ Ϛϯτ͢Δ
QBESJOPBENJO
QBESJOPBENJO ϞσϧʹରԠͨ͠ཧϖʔδΛՃͰ͖Δ QBESJOPHBENJO@QBHFmodel
QBESJOPBENJO ཧΞϓϦ༻ͷϔϧύʔϝιου͕͍͔ͭ͘Ճ͞ΕΔ 1 module SampleProject 2 class Admin < Padrino::Application
3 register Padrino::Mailer 4 register Padrino::Helpers 5 register Padrino::Admin::AccessControl 6 7 set :admin_model, 'Account' 8 set :login_page, '/sessions/new' 9 10 enable :sessions 11 disable :store_location 12 13 access_control.roles_for :any do |role| 14 role.protect '/' 15 role.allow '/sessions' 16 end 17 18 access_control.roles_for :admin do |role| 19 role.project_module :posts, '/posts' 20 role.project_module :accounts, '/accounts' 21 end 22 23 # Custom error management 24 error(403) { @title = "Error 403"; render('errors/403', :layout => :error) } 25 error(404) { @title = "Error 404"; render('errors/404', :layout => :error) } 26 error(500) { @title = "Error 500"; render('errors/500', :layout => :error) } 27 end 28 end
QBESJOPIFMQFST
QBESJOPIFMQFST ϑΥʔϜϦϯΫɺը૾༻ͷλάͳͲ )5.-λάΛੜ͢Δϝιου͕༻ՄೳʹͳΔ MJOL@UPJNBHF@UBHͳͲ3BJMTͱಉ͡Α͏ͳϝιου͕ఆٛ͞Ε͍ͯΔ input_tag :text, class: “demo” #=> <input
type='text' class='demo' /> ςϯϓϨʔτΛϨϯμϦϯά͢ΔͨΊͷϝιου SFOEFS QBSUJBM ͕༻ՄೳʹͳΔ render ‘path/to/any/template' partial 'photo/_item', object: @photo, locals: { foo: 'bar' }
QBESJOPDBDIF
QBESJOPDBDIF ςϯϓϨʔτͷϨϯμϦϯά݁Ռ ҙͷΦϒδΣΫτͷ༰ΛΩϟογϡͰ͖ΔΑ͏ʹͳΔ Ωϟογϡػߏͷϕʔεʹ.POFUB͕ར༻͞Ε͓ͯΓ σϑΥϧτͰ༷ʑͳΩϟογϡετΞ͕ར༻Մೳͱͳ͍ͬͯΔ 1 Padrino.cache = Padrino::Cache.new(:LRUHash) #
default choice 2 Padrino.cache = Padrino::Cache.new(:File, dir: Padrino.root('tmp', app_name.to_s, 'cache')) 3 Padrino.cache = Padrino::Cache.new(:Memcached, backend: memcached_or_dalli_instance) 4 Padrino.cache = Padrino::Cache.new(:Redis, backend: redis_instance) 5 Padrino.cache = Padrino::Cache.new(:Mongo, backend: mongo_client_instance) 1 module SampleProject 2 class App < Padrino::Application 3 register Padrino::Cache 4 enable :caching 5 6 get '/foo', cache: true do 7 expires 10 8 Time.now.to_s 9 end 10 end 11 end
QBESJOPNBJMFST
QBESJOPNBJMFST γϯϓϧͳΠϯλʔϑΣʔεͰϝʔϧ৴͕ߦ͑ΔΑ͏ʹͳΔ ϑΝΠϧͷఴϚϧνύʔτՄೳ .BJMϕʔε 1 class App < Sinatra::Base 2
register Padrino::Mailer 3 4 set :delivery_method, smtp: { 5 address: ‘smtp.gmail.com’, 6 port: 587, 7 domain: 'your.host.name', 8 user_name: '<username>', 9 password: '<password>', 10 authentication: 'plain', 11 enable_starttls_auto: true 12 } 13 14 post :mail do 15 email do 16 from: "
[email protected]
", 17 to: "
[email protected]
", 18 subject: "Welcome!", 19 body: "This is test mail." 20 end 21 end 22 23 end 1 module Sample 2 class App < Padrino::Application 3 register Padrino::Mailer 4 5 set :delivery_method, :sendmail 6 7 mailer :sample do 8 email :welcome do 9 from "
[email protected]
" 10 to "
[email protected]
" 11 subject "Welcome!" 12 add_file "/path/to/someotherfile.png" 13 provides :html, :plain 14 render "sample" 15 end 16 end 17 18 post :mail do 19 deliver :sample, :welcome 20 end 21 22 end 23 end
QBESJOPTVQQPSU
QBESJOPTVQQPSU QBESJOPΛαϙʔτ͢ΔͨΊͷϥΠϒϥϦू 4USJOHͷ֦ு DPMPSJ[F QMVSBMJ[F ࠃࡍԽରԠ༻ͷZBNMϑΝΠϧ͕ஔ͍ͯ͋Δ Ұ෦ͷϝιου"DUJWF4VQQPSUͷͷΛͦͷ··ར༻͍ͯ͠Δ
·ͱΊ
·ͱΊ 1BESJOPͱɺ 4JOBUSBͷ؆ܿ͞Λอͪͭͭɺ ෳࡶͳΞϓϦέʔγϣϯ։ൃʹඞཁͱͳΔΑ͏ͳػೳΛ ඞཁͳͱ͖ʹ͚Ճ͑Δࣄ͕Ͱ͖ΔΑ͏ʹͨ͠ 8FCΞϓϦέʔγϣϯϑϨʔϜϫʔΫ "HOPTUJD 03.ςϯϓϨʔτΤϯδϯͳͲΛࣗ༝ʹΈ߹ΘͤՄೳ .PVOUBCMF খ͞ͳ3BDLΞϓϦέʔγϣϯΛࣗ༝ʹΈ߹ΘͤՄೳ
None
ୈ෦ 1BESJOPΛͬͨ։ൃͷ࣮ફ 1BESJOPͰ։ൃΛߦ͏ࡍͷ5JQT ͷղܾํ๏ͳͲΛઆ໌͠·͢ɻ
1BESJOPͷΤίγεςϜ
1BESJOPͷΤίγεςϜ 3BDLϛυϧΣΞ SBDLDPOUSJC 4JOBUSBͷػೳ֦ு 4JOBUSB&YUFOUJPO
TJOBUSBDPOUSJC 1BESJOPͷػೳ֦ு 1BESJOP༻ͷ4JOBUSB&YUFOUJPO QBESJOPDPOUSJC 1BESJOPͷϓϥάΠϯػೳ QBESJOPSFDJQFTʹެࣜͷϨγϐ͕ެ։͞Ε͍ͯΔ
1BESJOPͷΤίγεςϜ 3BDLϛυϧΣΞ SBDLDPOUSJC 4JOBUSBͷػೳ֦ு 4JOBUSB&YUFOUJPO
TJOBUSBDPOUSJC 1BESJOPͷػೳ֦ு 1BESJOP༻ͷ4JOBUSB&YUFOUJPO QBESJOPDPOUSJC 1BESJOPͷϓϥάΠϯػೳ QBESJOPSFDJQFTʹެࣜͷϨγϐ͕ެ։͞Ε͍ͯΔ
1BESJOPͷϓϥάΠϯػೳ 5FNQMBUFT ϓϩδΣΫτͷ࡞खॱ͕هड़͞ΕͨςϯϓϨʔτϑΝΠϧΛݩʹ ৽͍͠1BESJOPϓϩδΣΫτΛੜ͢Δ͜ͱ͕Ͱ͖Δ QBESJOPHQSPKFDUTBNQMFUFNQMBUFQBUIUPNZ@UFNQMBUFSC
1BESJOPͷϓϥάΠϯػೳ 5FNQMBUFT
1BESJOPͷϓϥάΠϯػೳ 1MVHJOT ϨγϐϑΝΠϧΛݩʹɺ طଘͷ1BESJOPϓϩδΣΫτʹػೳՃ͕ߦ͑Δ QBESJOPHQMVHJOQBUIUPNZ@QMVHJOSC
1BESJOPͷϓϥάΠϯػೳ 1MVHJOT
ͦͷଞ 0NOJ"VUI 8BSEFO KQNPCJMF #SPXTFS XJMM@QBHJOBUF ,BNJOBSJ
#FUUFS&SSPST 4JOBUSBͰ͑Δͷී௨ʹ͑Δ QBESJOPQJQFMJOF QBESPOJBTTFUT 1BESJOPʹಛԽͨ͠ͷ͋Δ
1BESJOPΛ͍ͬͯ͘ͱ ૺ۰͢Δ
1BESJOPΛ͍ͬͯ͘ͱૺ۰͢Δ ίʔυͷංେԽ ֤छίϚϯυͰͷىಈ͕͘ͳΔ ։ൃαʔόىಈޙϦϩʔμʔ͕Կͱ͔ͯ͘͠ΕΔ͕ʜ 4QSJOH3BJMT༻ͩ͠4QPSLϝϯς͞Ε͍ͯͳ͍
4JOBUSBͷֶʹै͍খ͞ͳ෦ʹׂͰ͖ͳ͍͔ αϒΞϓϦέʔγϣϯ ΞϓϦέʔγϣϯͷHFNԽ
1BESJOPෳΞϓϦߏͷαϯϓϧ
1BESJOPͷใݯ
1BESJOPͷใݯ ެࣜϖʔδ
1BESJOPͷใݯ ެࣜυΩϡϝϯτ
1BESJOPͷใݯ FCPPL
1BESJOPͷใݯ ॻ੶ɾࡶࢽ
1BESJOPͷใݯ Δͼ· ߸
1BESJOPͷใݯ ͦͷଞ
1BESJOPͷใݯ ͦͷଞ
1BESJOPͷใݯ ͦͷଞ
1BESJOPͷใݯ ίʔυ
1BESJOPͷใݯ JEPCBUB 1BESJOPʹ͍ͭͯࡶஊͰ͖Δॴ͕ཉ͔ͬͨ͠ͷͰ࡞ͬͨ IUUQTJEPCBUBJPPSHBOJ[BUJPOTQBESJOPGSBNFXPSLKQSPPNTQVCMJDKPJO@SFRVFTU CEEBDGEDDC
1BESJOPͷࠓޙ
1BESJOPͷࠓޙ 1BESJOP͚ͯ ϚϧνεϨουͷαϙʔτ ৽͍͠ϧʔλʔͷಋೖ 1BESJOP"ENJOͷ৽ ϖʔδωʔγϣϯɺݕࡧɾϑΟϧλɺμΠφϛοΫͳ6*ͳͲ
ϦϑΝΫλϦϯά ϦϩʔμʔɺϩΨʔ υΩϡϝϯτͷඋ ґଘΛগͳ͘ɺΑΓݎ࿚ͰΑΓߴͳϑϨʔϜϫʔΫΛࢦ͢ 3BDL 4JOBUSBͷಈ
1BESJOPͷࠓޙ
࠷ޙʹ
1BESJOPͷߩݙ υΩϡϝϯτ ίʔυͷதɺެࣜυΩϡϝϯτɺຊޠ ϓϥάΠϯ ಈ͔ͳ͍ͷͷύονɺࣗͷཉ͍͠ͷ
HFN 3BDLϛυϧΣΞɺ4JOBUSB&YUFOUJPOɺ1BESJOPઐ༻ ίʔυ ίϝϯτमਖ਼ɺόάमਖ਼ɺ৽ػೳͷఏҊ
None
͓·͚
ͦͷଞͷ3VCZ 8FC"QQMJDBUJPO'SBNFXPSL ݸਓతʹؾʹͳ͍ͬͯΔͷ
None
None
None
ຖ݄ୈ̏ਫ༵։࠵ ौ୩पลͰ։࠵ ෆఆ IUUQTIJCVZBSCEPPSLFFQFSKQ