銀座Rails #1の招待講演のスライド #ginzarails
10.years of RailsDevelopment@a_matsudaۜ࠲Rails #1
View Slide
self Twitter: @a_matsuda GitHub: amatsuda
ࣄ ྲྀ͠ͷٕज़ސۀΈ͍ͨͳ
झຯ
झຯ৯า͖
RubyϓϩάϥϚʔ / RailsϓϩάϥϚʔ
ࠓͷ͓ͳ͠
ͬͺGinza SIX͔ͩΒ Rails 6ͷ
ͬͺGinza SIX͔ͩΒ Rails 6ͷ ͱࢥ͚ͬͨͲɺ ͋Μ·Γ͍ͨ͜͠ͱ͕ͳ͍ͷͰɺ
ʮRailsʹ͍ͭͯͷࣝΛަ͠ɺʑͷ։ൃʹཱ͍ͯͯ͜͏ʯ
Rails։ൃऀͷํʁ
10Ҏ্Rails։ൃऀ ͬͯΔํʁ
ͪΐͬͱੲ
10.years.ago
github.com͕Ͱ͖ͨ
Rails͡Ί·ͨ͠
Asakusa.rbୈ1ճmeetupͷ Ռ
ϦϙδτϦ4݄͔ΒGitHubʹஔ͔Ε͚ͯͨͲɺύονΔΓ͡Όͳͯ͘BTSʹషΔํࣜͩͬͨ https://rails.lighthouseapp.com/projects/8994/tickets/623
͋Ε͔Β10
739 Commits ฏۉ5Ͱ1ίϛοτ͙Β͍ͱ͍͏͜ͱ͕Θ͔Δ
ࢥ͍ग़ਂ͍ίϛοτͨͪ
always enable pp on theRails console https://github.com/rails/rails/commit/d54c7781
always enable pp on theRails console 2011ͷ࣌Ͱmame͞ΜͷRuby 2.5ͷ৽ػೳΛઌऔΓ͍ͯͨ͜͠ͱ͕Θ͔Δ
for ... in => .each https://github.com/rails/rails/commit/22ed6cb7
for ... in => .each Railsਓͨͪ each Λ͏ͷͩͱࢥΘΕ͕͚ͪͩͲɺ࣮DHH for ... in Ͱॻ͍ͯͨʂ
treat fullwidth whitespaceas a blank character https://github.com/rails/rails/commit/9c608603
treat fullwidth whitespaceas a blank character String#blank? ͕શ֯εϖʔεͱ͔ͦͷଞݟ͑ͳ͍จࣈΛશ෦ۭനѻ͍͢ΔΑ͏ʹ ͭ·ΓɺString#blank? ͨ͘͠ͷΦϨΦϨ
Relation.where with no args can bechained with not, like, and not_like https://github.com/rails/rails/commit/de75af7a
Relation.where with no args can bechained with not, like, and not_like 4छྨͷsyntaxΛ࣮ͯ͠ఏҊ ࠓͷ where.not() ͷsyntaxJeremyҊ where.like ͱ͔ where.not_like ࣮͚ͨ͠ͲɺޙʹDHHʹϦόʔτ ͞Εͨ
tyop https://github.com/rails/rails/commit/c7f1bcd2
tabenai (typo) https://github.com/rails/rails/commit/407baa2b
tabenai (typo) ͍·ͩʹkamipo͞Μʹݴٴ͞ΕΔίϛοτ……
Space Oddity https://github.com/rails/rails/commit/d9bdb611
Space Oddity David Bowie͕͘ͳͬͨͷͰ͓͔͠ͳεϖʔεΛ୳ͯ͠ίϛοτ
Ruby and Rails ࣗͷओͳकඋൣғRubyͱRailsͷؒͷ͋ͨΓ͔ͳɺͱࢥͬͯΔͷͰɺͪΐͬͱͦ͜ΜͷΛ͠·͢ɻ
kwargs &binding.local_variable_get Rails ͰͬͯΈΔ͜ͱͰ :if ͱ͔ :unless ͱ͍͏ϢʔεέʔεΛൃݟ Ruby 2.2͋ͨΓͰbinding.local_variable_get Λ ಋೖ
frozen_string_literal https://bugs.ruby-lang.org/issues/8976#change-53900
frozen_string_literal Railsͷ .freeze ࠈΛղফ͢Δ ͨΊʹRubyଆʹಋೖΛఏҊ
Refinements https://github.com/rails/rails/commit/571f0f32
Refinements Railsʹಋೖ͠(ͯRubiniusͰಈ͔ͳ͘͠)ͨͷΦϨΦϨ
require_relative ͩ͞͞͞Μʹͦͦͷ͔͞ΕͯRailsͰͬͯΈͨΒόάͬͯͨ Ruby 2.4͙Β͍Ͱमਖ਼
protected Railsք۾ͰͨΒͱޡ༻͞Εଓ͚͖ͯͨػೳ ΄΅શͯ private ͷؒҧ͍
When you say `protected` in Ruby,you might 99% be meaning `private` https://github.com/amatsuda/rails/commit/6832343c
࣮ࡍͷίϛοτϥΠϒϥϦ͝ͱʹ rdocͷग़ྗ݁ՌΛ֬ೝ͠ͳ͕Β
Privatize unneededly protectedmethods in Active Record https://github.com/rails/rails/commit/5b14129d ͳͲͳͲ
ηΩϡϦςΟؔ࿈ύον ͍͔ͭ͘ https://github.com/rails/rails/commit/87eab595 https://github.com/rails/rails/commit/dfa33fa3 ͱͦͷपล ͳͲͳͲ
௨Βͳ͔ͬͨఏҊͨͪ
Sexier migrations https://github.com/rails/rails/pull/1163
Sexier migrations migrationͷ t. ΛΔͭ t. ཁΒͳ͍ͱࢥ͏Μ͚ͩͲͳ͊
automatic client side validationwith HTML 5 "required" attribute https://github.com/rails/rails/pull/3590
automatic client side validationwith HTML 5 "required" attribute Ϟσϧʹॻ͍ͨvalidationΛΫϥΠΞϯταΠυʹө 2011ʹఏҊ ࣌ΛઌऔΓ͗ͯͯ͢͠ݟૹΒΕͨ
Action Args ΞΫγϣϯϝιουʹҾΛ ΔΓग़ͯ͠ͳͯ͘ɺνϟοτͰఏҊͨ͠ؾ͕͢Δ DHHʹେےͰؾʹೖͬͯΒ͑ͨͷͷɺࡉ͔͍෦ͷ༷͕ંΓ߹Θͣ٫Լ
օ͞Μ͔Βͷ :+1:ܴ͠·͢
͜Μͳײ͡ͰɺRailsຊମʹಥͬࠐΉҎ֎ʹɺ ϓϥάΠϯͱ࣮ͯ͢͠Δ͜ͱ͋Γ·͢
ϓϥΪϯ։ൃ
i18n_generators
i18n_generators I18nͷϦιʔεΛਓ͕ؒॻ͔ͳͯ͘Α͘ͳΔ࠷ߴʹΜΓͳͭ 10લʹ࡞͚ͬͨͭͩͲɺRails 5.2Ͱະͩʹ͑Δ
kaminari
kaminari ϖʔδωʔγϣϯ͢Δͭ Rails 3Ͱಈ͍ͯΔͷ͕ͳ͔ͬͨͷͰ࡞ͬͨ M, V, Cͷ3ͭͷϨΠϠʔʹ ·͕ͨΔػೳ
Rails 3ͷ৽ػೳɺRails Engine ͬͯͭͰ࡞ͬͯΈͨͯ͘࡞ͬͨ
ͨͿΜੈքͰ2൪͙Β͍ʹݹ͍ ࣮༻ϨϕϧͷEngine
action_args
action_args DHHʹఏҊ͕௨Βͳ͔͚ͬͨͲɺgemͰ͝ར༻͍͚ͨͩ·͢ Asakusa.rb໊ٛͰϝϯς શRailsϓϥάΠϯͷதͰҰ൪͖ ͱ͍͏͔ɺ͜Ε͕ೖͬͯͳ͍ͱRailsΞϓϦॻ͚ͳ͍
active_decorator
active_decorator ϔϧύʔॻ͖ͨ͘ͳ͍(ϔϧύʔࢮΜͰ΄͍͠) ઌߦϓϩμΫτ͕ͼͬ͘Γ͢Δ͙Β͍ϔϘ͔ͬͨͷͰ༷࣮1000ഒ͙Β͍ϚγͳͭΛࣗ࡞ OpinionatedͳσβΠϯ
OpinionatedͳσβΠϯ ࠷ۙͷόʔδϣϯͰ݁ہંΕͨͷͰɺ෦తʹഊͨ͠ͱݴ͑Δ
html5_validations ຊମͷఏҊ௨Βͳ͔͚ͬͨͲgemͰ͝ར༻͍͚ͨͩ·͢ ϓϥάΠϯ࡞Γͷڭࡐʹͪΐ͏Ͳ͍͍͔
stateful_enum
stateful_enum AR֦ுܥ ΊͪΌΊͪΌ࣮༻త σβΠϯ࣮γϯϓϧͰ៉ྷ(ͩͬͨ)
erd
erd ERਤΛϒϥβ্Ͱΰχϣΰχϣ͢ΔEngine ඍົʹະ
Rails Engine͍͍ΑͶ
hocus_pocus
hocus_pocus Rails Engineͷݶքʹઓͨ͠ ҙཉ࡞ υΩϡϝϯτ͕օແͳͷͰͨͿΜ ͑ͳ͍ web_consoleΛΠϯεύΠΞͨ͠ͱ͍͏ྺ࢙తҙٛ
ͦΖͦΖ·ͱΊ
ͱ͍͏͜ͱͰɺʑͷ։ൃͷΛ͠·ͨ͠
Railsϓϩάϥϛϯάͨͷ͍͠
RailsϓϩάϥϛϯάͰΛ ੜͦ͏ʂ
ଓ͖࠙ձͰʂ