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
900
初めての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
110
STORES.jp 開発組織の軌跡 / Rails Developers Meetup 2018 Day4
tyabe
1
730
ImageFlux x STORES.jp
tyabe
0
2.9k
STORES.jp開発チームのこれまでとこれから
tyabe
0
530
Yokohama.rb Monthly Meetup #50
tyabe
1
520
RubyKaja 2014
tyabe
0
300
Favorite points of Padrino
tyabe
0
100
「eye」でカジュアルにプロセス監視
tyabe
0
51
PadrinoDecorator
tyabe
0
52
Other Decks in Technology
See All in Technology
日経電子版におけるリアルタイムレコメンドシステム開発の事例紹介/nikkei-realtime-recommender-system
yng87
1
510
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
27
12k
Apple/Google/Amazonの決済システムの違いを踏まえた定期購読課金システムの構築 / abema-billing-system
cyberagentdevelopers
PRO
1
220
Vueで Webコンポーネントを作って Reactで使う / 20241030-cloudsign-vuefes_after_night
bengo4com
4
2.5k
チームを主語にしてみる / Making "Team" the Subject
ar_tama
4
310
omakaseしないための.rubocop.yml のつくりかた / How to Build Your .rubocop.yml to Avoid Omakase #kaigionrails
linkers_tech
3
740
話題のGraphRAG、その可能性と課題を理解する
hide212131
4
1.5k
スプリントゴールにチームの状態も設定する背景とその効果 / Team state in sprint goals why and impact
kakehashi
2
100
プロダクトエンジニアが活躍する環境を作りたくて 事業責任者になった話 ~プロダクトエンジニアの行き着く先~
gimupop
1
480
現地でMeet Upをやる場合の注意点〜反省点を添えて〜
shotashiratori
0
530
[JAWS-UG金沢支部×コンテナ支部合同企画]コンテナとは何か
furuton
3
260
物価高なラスベガスでの過ごし方
zakky
0
390
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
66
10k
Unsuck your backbone
ammeep
668
57k
The Pragmatic Product Professional
lauravandoore
31
6.3k
A Tale of Four Properties
chriscoyier
156
23k
Faster Mobile Websites
deanohume
304
30k
The Cost Of JavaScript in 2023
addyosmani
45
6.6k
A better future with KSS
kneath
238
17k
Why Our Code Smells
bkeepers
PRO
334
57k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
It's Worth the Effort
3n
183
27k
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