Slide 1

Slide 1 text

αʔϏεΛ Ruby / Rails Ͱ੒ ௕ͤ͞ΔͨΊʹ΍ͬͨ͜ͱ

Slide 2

Slide 2 text

ࣗݾ঺հ ɹɾ໊લ ɹɹࠤ౻ ݩل ɹɾϝυϐΞྺ ɹɹ 2017/9 ʙ WebΤϯδχΞɹɹ ɹɹʢ࠷ۙ͸ElasticsearchɺAWS SNSͰPush௨஌पΓʣ ɹɾͦͷલ ɹɹ- Ruby on Rails/ C++ (ιʔγϟϧήʔϜ) ɹɹ- PHP Maple/ΦϨΦϨ (ձһ੍ಈըܥαʔϏε)

Slide 3

Slide 3 text

ϝυϐΞͷྠಡձ

Slide 4

Slide 4 text

લஔ͖ ϝυϐΞͷݱঢ়

Slide 5

Slide 5 text

ҩࢣઐ༻αΠτʮMedPeerʯ

Slide 6

Slide 6 text

Ruby on Rails (৽؀ڥ)ͱ PHP on ಠࣗϑϨʔϜϫʔΫ(چ؀ڥ) ͕ڞଘ

Slide 7

Slide 7 text

ฐࣾϒϩά: ɹϨΨγʔͳಠࣗϑϨʔϜϫʔΫ͔Β୤٫ͯ͠Rails΁ঃʑʹҠߦ ͍ͯ͠Δ࿩ http://tech.medpeer.co.jp/entry/2017/01/31/004227

Slide 8

Slide 8 text

PHP͔ΒRuby on Rails΁ͷ Ҡߦελʔτ͸໿1.5೥લ

Slide 9

Slide 9 text

RubyΤϯδχΞ : 10ਓத2ਓ

Slide 10

Slide 10 text

Ҡߦͷҝʹ ɾPHP࢖͍ͬͯΔਓ͕RubyΛ࢝ΊͨΓ ɾRubyະܦݧऀ͕ೖͬͨΓʢܦݧऀ΋ೖͬͨΓʣ

Slide 11

Slide 11 text

Ruby/Railsͷܦݧগͳ͍ਓ͔Βଟ͍ਓ·Ͱ ෯޿͍ҝɺRuby/RailsΛϝΠϯʹ੒௕ͷҝ ͷऔΓ૊ΈΛߦ͍ͬͯ·͢ɻ

Slide 12

Slide 12 text

෱ԬRubyձٞ: ɹϝυϐΞͷશྗRailsԽͷऔΓ૊Έࡽ͠·͢! ( by CTO fukumura ) https://speakerdeck.com/fukumura/metohiafalsequan-li- railshua-falsequ-rizu-mishai-simasu

Slide 13

Slide 13 text

ओͳऔΓ૊Έ ɾίʔυϨϏϡʔʢRailsܦݧଟ͍ਓͷϨϏϡʔʣ ɹ2017೥ʹ࢝ΊͨϝυϐΞΤϯδχΞνʔϜͷ৽͍͠औΓ૊Έʹ͍ͭͯ ɹhttp://tech.medpeer.co.jp/entry/2017/12/27/180000 ɾ։ൃ߹॓ ɹ։ൃ߹॓!?ͦΕͳΒϖϯγϣϯͰ͠ΐ!! ʙ܈അݝΈͳ͔Έொ΁ͷϝυϐΞ։ൃ߹॓೔ࢽʙ ɹ http://tech.medpeer.co.jp/entry/2017/12/06/110000

Slide 14

Slide 14 text

ओͳऔΓ૊Έ ɾKPT಺ͰؾʹͳΔϨϏϡʔΛৼΓฦΔ ɾಡॻձʢྠಡձʣ

Slide 15

Slide 15 text

ྠಡձ 
 ɾͲ͏΍͍ͬͯΔ͔ ɾྑ͔ͬͨ/ѱ͔ͬͨࣄ

Slide 16

Slide 16 text

ྠಡձͱ͸ ਓʑ͕ू·ͬͯɺಉ͡ڭՊॻͳͲͷຊΛಡΈɺͦͷ ಺༰ʹ͍ͭͯҙݟΛަΘ͢͜ͱΛҙຯ͢Δޠ

Slide 17

Slide 17 text

Ұਓಡॻͷྑ͍ॴ ɾ޷͖ͳ࣌ʹಡΊΔ ɾ޷͖ͳ৔ॴͰಡΊΔ ɾ޷͖ͳϖʔεͰಡΊΔʢௐ΂ͨΓɺࢼ ͨ͠Γ ɾ஌ͬͯΔॴ͸ඈ͹ͤΔ

Slide 18

Slide 18 text

ྠಡձ > Ұਓͷಡॻ ͱ͍͏Θ͚Ͱ͸ͳ͍

Slide 19

Slide 19 text

ྠಡձͱ͸ ਓʑ͕ू·ͬͯɺಉ͡ڭՊॻͳͲͷຊΛಡΈɺͦ ͷ಺༰ʹ͍ͭͯҙݟΛަΘ͢͜ͱΛҙຯ͢Δޠ (weblioΑΓ) →ྠಡձͷதͰ΋ɺಛʹ͜ͷதͰྑ͔ͬͨ෦෼ͷ ࿩

Slide 20

Slide 20 text

ϝυϐΞͰͷ΍Γํ ຊ͝ͱʹ΍Γํม͑ͨΓ͍ͯ͠Δ͕ɺ ɾ1ਓ1߲໨ɺԻಡ͢Δ ɾಡΜͩॴͷ࣭໰΍ٞ࿦ʢແ͍࣌΋͋Δʣ ɾ౰൪੍Ͱൃදऀ͕ઌʹ಺༰·ͱΊͨΓ ɹˠ΍Γํ͸·ͩ໛ࡧத

Slide 21

Slide 21 text

༷ࢠ

Slide 22

Slide 22 text

ϝυϐΞͷΑ͏ʹɺ ɾRuby/Railsͷܦݧ →·ͪ·ͪ ɾϝυϐΞྺ → ·ͪ·ͪ ɾಉ͡ιʔείʔυʢϦϙδτϦʣ৮Δࣄ͕ଟ͍ ͱ͍͏ঢ়گͰɺ ྠಡձܗ͕ࣜྑ͔ͬͨͳͱࢥ͏ࣄྫͷ঺հ

Slide 23

Slide 23 text

ྫ1 RailsGuides
 https://railsguides.jp/ ʢຊͱݴ͏͔αΠτͰ͕͢ʣ

Slide 24

Slide 24 text

ͳΜͰ͜ͷຊʹ͔ͨ͠ ɾRailsͷػೳΛମܥతʹΘ͔Γ΍͘͢঺հ͍ͯͯ͠ɺ ܦݧ(গ)ͳ͍ਓʹ΋ͱ͖ͬͭ΍͍͢

Slide 25

Slide 25 text

͜ͷຊͷྠಡձͰ͋ͬͨٞ࿦

Slide 26

Slide 26 text

Action Controller ͷ֓ཁ (8.ϑΟϧλ) ٞ࿦΍࣭໰ ʮControllerͷfillterɺonly΋͘͠͸exceptͰࢦఆ͢Δ৔ ߹ɺͲͪΒΛ࢖͏ʁʯ ʮͱΓ͋͑ͣ҆શଆʹ౗ΕΔํ͕ྑͦ͞͏ʯ ɹ

Slide 27

Slide 27 text

ɾܦݧগͳ͍ਓ ɹػೳ + ࢖͏ஈ֊ʹͳͬͯ໎͏෦෼ΛઌʹҙࣝͰ͖ ͨ ɾͦΕҎ֎ͷਓ ɹνʔϜ಺Ͱ͸Ͳ͏͢Δ͔ͷҙࣝΛ߹ΘͤΔ͜ͱ͕ Ͱ͖ͨ ɹ

Slide 28

Slide 28 text

ྫ2 Everyday Rails - RSpec ʹΑΔRailsςετೖ໳

Slide 29

Slide 29 text

ͳΜͰ͜ͷຊʹ͔ͨ͠ ςετΛRSpecͰॻ͍͍͕ͯͨɺ ɾςετͷཻ౓͕ҧͬͨΓ ɾਖ਼͍͠ॻ͖ํͰ͖ͯΔ͔ո͍͠ʢଞͷΛਅࣅ͍ͯΔ͚ͩʁʣ ͱ͍͏໰୊఺ͷղফͷҝ

Slide 30

Slide 30 text

͜ͷຊͷྠಡձͰ͋ͬͨٞ࿦

Slide 31

Slide 31 text

7.ίϯτϩʔϥεϖοΫͷΫϦʔϯΞοϓ ٞ࿦΍࣭໰ ʮShared Examples ɺॏෳഉআͰ͖ͯྑ͍ʯ ʮॲཧ͕ݟ͑ʹ͘͘ͳΔ໘΋͋ΔɻݟͮΒ͘ͳΒͳ͍͔΋ߟ͑ ͯ࢖ͬͨํ͕ྑ͍ʯ

Slide 32

Slide 32 text

ɾܦݧগͳ͍ਓ ɹػೳ+ܦݧऀͷͭΒΈΛઌʹ஌Εͨ ɾͦΕҎ֎ͷਓ ɹνʔϜ಺Ͱ͸Ͳ͏͢Δ͔ɺҙࣝ߹ΘͤͰ͖ͨ

Slide 33

Slide 33 text

?.??(Ͳͷষ͔ͩͬͨ๨Ε·ͨ͠ʣ ٞ࿦΍࣭໰ ʮRakeλεΫ΋ςετॻ͘ʁʯ ʮmodel(౳)ʹϩδοΫҠৡͯͦ͠ΕΛݺͼग़͚ͩ͢ʹ ͍ͨ͠ʯ ʮͰ΋typoνΣοΫ͚ͩͷҝͰ΋ςετ͋ͬͨ΄͏͕҆ ৺ʯ

Slide 34

Slide 34 text

ܦݧଟ͍/গͳ͍ݶΒͣɺνʔϜ಺Ͱ ͳΜͱͳ͘;Θͬͱ͍ͯͨ͠ॴ͕࿩߹ ͑ͨɻ·ͨɺͦͷߟ͑Λڞ༗Ͱ͖ͨɻ

Slide 35

Slide 35 text

ྫ3ʣΦϒδΣΫτࢦ޲ઃܭ ࣮ફΨΠυͷ৔߹

Slide 36

Slide 36 text

ͳΜͰ͜ͷຊʹ͔ͨ͠ ɾRailsҠߦ͕গ͠ਐΈɺΦϒδΣΫτࢦ޲ ઃܭతͳ෦෼Ͱ໰୊఺͕ݟ͖͑ͯͨͨΊ

Slide 37

Slide 37 text

͜ͷຊͷྠಡձͰ͋ͬͨٞ࿦

Slide 38

Slide 38 text

ୈ̑ষɹμοΫλΠϐϯάͰίετΛ࡟ݮ͢ Δ ٞ࿦΍࣭໰ ʮμοΫλΠϐϯάා͍ɻJavaͳΒΠϯλʔϑΣʔεͱ͔͋Δͷʹʯ ɹɹɹɹɹ

Slide 39

Slide 39 text

ɾPHP/Ruby ܦݧऀ ɹ੩తܕ෇͚ݴޠͷܦݧऀͱײ֮ͷࠩΛײ͡Εͨ ɾJava ܦݧऀ ɹಉ͡ΦϒδΣΫτࢦ޲Ͱ΋ɺ࣮૷ํ๏ʹ͔ͳΓࠩ ͕͋Δ͜ͱ͕Θ͔ͬͨ

Slide 40

Slide 40 text

4.5 σϝςϧͷ๏ଇ σϝςϧͷ๏ଇ͸ɺΦϒδΣΫτΛૄ݁߹ʹ͢Δ ͨΊͷن໿ͷू·Γɻ͜ͷதͰҕৡ΋ग़ͯ͘Δɻ

Slide 41

Slide 41 text

4.5 σϝςϧͷ๏ଇ ٞ࿦΍࣭໰ ʮҕৡɺActiveRecordͰ΍ΔͳΒdelegate͕͋Δʯ ʮdelegateɺϧʔϓͰN+1͕ൃੜ͢ΔՕॴΛݟམͱ͠ ΍͘͢ͳΔ͜ͱ΋ʯ

Slide 42

Slide 42 text

ຊ͸RubyϝΠϯͳͷͰRails΍ActiveRecordʹ͍ͭͯ͸ ৮Ε͍ͯͳ͍ ͕ɺ RailsΞϓϦ։ൃϝϯόʔͰͷಡॻձͩͬͨͷͰݱ৔Ͱ࢖ ͏࣌ͷ࢖͍ํ΍ؾΛ͚ͭΔϙΠϯτΛઌʹ࿩͢͜ͱ͕Ͱ ͖ͨɻ

Slide 43

Slide 43 text

ୈ6ষ ܧঝʹΑͬͯৼΔ෣͍Λ֫ಘ͢Δ ٞ࿦΍࣭໰ ʮܧঝͰඍົͳڞ௨Խ͕͞ΕͯͭΒ͍ॴ͕hogeॲཧʹ͋ Δʯ ʮڞ௨Խ΋ͨͩιʔείʔυ͕ಉ͔ͩ͡Βͬͯ΍ͬͯ͘ͱޙ ͰٯʹͭΒ͘ͳΔʯ

Slide 44

Slide 44 text

ಉ͡ιʔείʔυΛ৮Δϝϯόʔ͔Βɺ ۩ମతͳྫͷڞ༗΍ͱະདྷͷͭΒΈ๷͙͖͔͚͕ͬ Ͱ͖ͨɻ

Slide 45

Slide 45 text

͜Μͳײ͡ͰɺྠಡձΛ͢Δ ࣄͰຊͷ಺༰Ҏ֎ʹ͍Ζ͍Ζ ಘΔ΋ͷ͕͋Γ·ͨ͠

Slide 46

Slide 46 text

ྠಡձΛଓ͚ΒΕΔ؀ڥ

Slide 47

Slide 47 text

ɾ࣌ؒ ɹۀ຿࣌ؒ಺ɻਫ༵10:30ʙ11:30 ɹۀ຿ޙ΍ேૣ͗͢ΔͱɺͨͿΜࢀՃऀݮΔɻ ɹશһͷͨΊͷऔΓ૊ΈͰͳ͘ͳͬͯ͠·͏ɻ

Slide 48

Slide 48 text

ɾຊ୅ ɹձࣾܦඅɻ1ਓ1࡭ɺిࢠॻ੶Ͱ΋࣮෺Ͱ΋OKɻ ɹܦඅͰམͱͤͳ͍ͱΈΜͳͰಉ͡ຊΛݟΔͱ͍͏ ϋʔυϧ্͕Δɻ

Slide 49

Slide 49 text

ձࣾͷཧղ͕͋ͬͯͦ͜ ಛʹ ɾۀ຿࣌ؒ಺ʹ΍Δ͜ͱ ຊಡΉͷ͕ۀ຿ͳͷʁͱɺΤϯδχΞҎ֎͕ී௨ʹٙ໰Λײ͡Δؾ͕͢Δɻ ɹˠʮಡॻձ/ྠಡձʯ໊ͬͯલ͕ۀ຿ײग़ʹ͍͘ͷͰʮγεςϜ։ൃख๏ ʹ͍ͭͯͷhogeʯͷΑ͏ͳ໊લʹͨ͠Γۀ຿ײग़͢ͷ͸͋Γ͔΋ʁ

Slide 50

Slide 50 text

PRϖʔδ ϝυϐΞ͸ΤϯδχΞ׆ಈʹཧղ͋ΔձࣾͰ͢ɻ CTO fukumuraʮؤுͬͯܦӦਞઆಘͯͨ͠Ͷͬͯੲͷಉ྅͔ΒݴΘΕͨɻ ͦΜͳʹؤுͬͯͨͭ΋Γແ͔ͬͨʯ ↓࠷ۙͷ࣮੷ ɹRuby25प೥ه೦ΠϕϯτɺܦඅͰߦ͚·͢ʢϝυϐΞ΋εϙϯαʔ΍ͬ ͯ·͢ʣ

Slide 51

Slide 51 text

ٞࣄ࿥ ɹ͋ͬͨํ͕ྑ͍ɻ ʢձ࿩ͷதͰग़ͨࢀߟURLͳͲ΋SlackʹషͬͨΓ͍ͯ͠·͢ʣ ɹɾܽ੮ऀ͕࣍ʹࢀՃ͠΍͍͢Α͏ʹ ɹɾ๨Εͳ͍Α͏ʹ ɹɾະདྷͷϝϯόʔʹ΋఻ΘΔΑ͏ʹ ɹɾϒϩάωλ

Slide 52

Slide 52 text

ࢀՃϝϯόʔ ͓୊ʹରͯ͠ɺܦݧଟ͍ਓ͕͍ͨํ͕ྑ͍ ɾ࣭໰ɺٞ࿦Λͦͷ৔ͰղܾͰ͖Δ ɾຊ͚ͩͩͱແ͍ܦݧΛઌʹ࿩ͤΔ ʢϝυϐΞ͸ɺٕज़ސ໰willnet͞ΜʹඞͣࢀՃͯ͠ ΋Β͍ͬͯ·͢ʣ

Slide 53

Slide 53 text

ͲΜͳຊ͕ྑ͔͔ͬͨʢྑͦ͞͏͔ʣ 1.ͦͷ৔Ͱ΋͋Δఔ౓ཧղͰ͖Δ ɹ༧श͖͍ͯͯ͠ͳ͍લఏɻࢀՃϋʔυϧ্͛ͳ͍ɻ

Slide 54

Slide 54 text

ͲΜͳຊ͕ྑ͔͔ͬͨʢྑͦ͞͏͔ʣ 
 2.αϯϓϧίʔυ͕ϝΠϯͰͳ͍ ɹ௕͍αϯϓϧίʔυ͕͋Δͱɺͦ͜ͰཧղͰ͖Δਓ/Ͱ͖ͳ͍ਓ͕Ͱ͖ͯ ΍͍͢ɻ ɹࢀߟఔ౓ʹॻ͍ͯ͋Δ΋ͷ΍ɺRails GuidesΈ͍ͨʹ୹ͯ͘ཧղ͠΍͍͢ ΋ͷ͸େৎ෉ɻ

Slide 55

Slide 55 text

ͲΜͳຊ͕ྑ͔͔ͬͨʢྑͦ͞͏͔ʣ 3.಺༰͕ຖճ׬݁͢Δ΋ͷ ɹܽ੮ɺهԱ͕ඈͿͳͲɺલͷ಺༰͕಄ʹͳ͍ͱ࣍ͷཧղ͕೉͍͠ɻ ɹʮ ΦϒδΣΫτࢦ޲ઃܭ࣮ફΨΠυʯ΋ɺ͖͍ͭ෦෼͸͋Δɻ

Slide 56

Slide 56 text

ͲΜͳຊ͕ྑ͔͔ͬͨʢྑͦ͞͏͔ʣ 4.ͦͷ࣌ඞཁͳ΋ͷ ɹRailsҠߦ౰ॳ͸RailsΨΠυɺগ͠ܦͬͯઃܭʹվળ఺͕ݟ͖͑ͯͨΒ ɹʮΦϒδΣΫτࢦ޲ઃܭ࣮ફΨΠυʯͳͲɻ ɹཧղ͠ͳ͍ͱ·͍ͣ > ཧղ͍ͨ͠

Slide 57

Slide 57 text

՝୊ ɾਓ͕૿͑Δͱո͍͠ ɹࠓ͸10ਓఔ౓͕ͩɺਓ͕૿͑Δͱࣗ෼͕ಡΉ ॱ൪΋ճΓͮΒ͘ۓுײແ͘ͳΓձ࿩΋ͮ͠Β ͘ͳΔؾ͕͢Δ ɹ

Slide 58

Slide 58 text

՝୊ ɾ໊લ͕ී௨͔ͩΒม͍͑ͨ ɹʮྠಡձʯΛΤοδ͕ޮ͍ͨײ͡ʹ

Slide 59

Slide 59 text

·ͱΊ ɾҰਓಡॻ΋ྑ͍͚Ͳྠಡձ΋͍͍ ɾຊʹॻ͍ͯ͋Δ͜ͱҎ֎͕ಘΒΕͨ ɹ- ܦݧʢऀͷ੠ʣ ɹ- ҧ͏ࢹ఺ ɹ- ࣗ෼ͨͪ͸Ͳ͏͍͔ͯ͘͠ ɾձࣾͷཧղʢۀ຿࣌ؒɺ͓ۚʣඞཁ

Slide 60

Slide 60 text

͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠