メドピアの輪読会
by
motsat
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
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ϝΠϯͳͷͰRailsActiveRecordʹ͍ͭͯ ৮Ε͍ͯͳ͍ ͕ɺ 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
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠