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
120
STORES.jp 開発組織の軌跡 / Rails Developers Meetup 2018 Day4
tyabe
1
740
ImageFlux x STORES.jp
tyabe
0
2.9k
STORES.jp開発チームのこれまでとこれから
tyabe
0
530
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
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
Can We Measure Developer Productivity?
ewolff
1
150
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
10XにおけるData Contractの導入について: Data Contract事例共有会
10xinc
5
560
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
開発生産性を上げながらビジネスも30倍成長させてきたチームの姿
kamina_zzz
2
1.7k
元旅行会社の情シス部員が教えるおすすめなre:Inventへの行き方 / What is the most efficient way to re:Invent
naospon
2
330
OCI 運用監視サービス 概要
oracle4engineer
PRO
0
4.8k
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
490
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1366
200k
Building Your Own Lightsaber
phodgson
103
6.1k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Done Done
chrislema
181
16k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
740
[RailsConf 2023] Rails as a piece of cake
palkan
52
4.9k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Speed Design
sergeychernyshev
24
610
For a Future-Friendly Web
brad_frost
175
9.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Docker and Python
trallard
40
3.1k
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