Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ginza Rails 1

Ginza Rails 1

銀座Rails #1の招待講演のスライド #ginzarails

Akira Matsuda

September 20, 2018
Tweet

More Decks by Akira Matsuda

Other Decks in Programming

Transcript

  1. 10.years of Rails
    Development
    @a_matsuda
    ۜ࠲Rails #1

    View full-size slide

  2. self
    Twitter: @a_matsuda
    GitHub: amatsuda

    View full-size slide

  3. ࢓ࣄ
    ྲྀ͠ͷٕज़ސ໰ۀΈ͍ͨͳ

    View full-size slide

  4. झຯ͸৯΂า͖

    View full-size slide

  5. RubyϓϩάϥϚʔ / Railsϓϩά
    ϥϚʔ

    View full-size slide

  6. ࠓ೔ͷ͓͸ͳ͠

    View full-size slide

  7. ΍ͬͺGinza SIX͔ͩΒ

    Rails 6ͷ࿩

    View full-size slide

  8. ΍ͬͺGinza SIX͔ͩΒ

    Rails 6ͷ࿩
    ͱࢥ͚ͬͨͲɺ
    ͋Μ·Γ࿩͍ͨ͜͠ͱ͕ͳ͍ͷͰɺ

    View full-size slide

  9. ʮRailsʹ͍ͭͯͷ஌ࣝΛަ׵͠ɺ
    ೔ʑͷ։ൃʹ໾ཱ͍ͯͯ͜͏ʯ

    View full-size slide

  10. Rails։ൃऀͷํʁ

    View full-size slide

  11. 10೥Ҏ্Rails։ൃऀ

    ΍ͬͯΔํʁ

    View full-size slide

  12. ͪΐͬͱੲ࿩

    View full-size slide

  13. 10.years.ago

    View full-size slide

  14. github.com͕Ͱ͖ͨ೥

    View full-size slide

  15. Rails͸͡Ί·ͨ͠

    View full-size slide

  16. Asakusa.rbୈ1ճmeetupͷ

    ੒Ռ෺

    View full-size slide

  17. ϦϙδτϦ͸4݄͔ΒGitHubʹஔ͔Ε͚ͯͨͲɺ
    ύον͸΀ΔΓ͡Όͳͯ͘BTSʹషΔํࣜͩͬͨ
    https:/
    /
    rails.lighthouseapp.com/
    projects/8994/tickets/623

    View full-size slide

  18. ͋Ε͔Β10೥

    View full-size slide

  19. 739 Commits
    ฏۉ5೔Ͱ1ίϛοτ͙Β͍ͱ͍͏
    ͜ͱ͕Θ͔Δ

    View full-size slide

  20. ࢥ͍ग़ਂ͍ίϛοτͨͪ

    View full-size slide

  21. always enable pp on the
    Rails console
    https:/
    /github.com/rails/rails/
    commit/d54c7781

    View full-size slide

  22. always enable pp on the
    Rails console
    2011೥ͷ࣌఺Ͱmame͞Μͷ
    Ruby 2.5ͷ৽ػೳΛઌऔΓ͍ͯ͠
    ͨ͜ͱ͕Θ͔Δ

    View full-size slide

  23. for ... in => .each
    https:/
    /github.com/rails/rails/
    commit/22ed6cb7

    View full-size slide

  24. for ... in => .each
    Railsਓͨͪ͸ each Λ࢖͏΋ͷͩ
    ͱࢥΘΕ͕͚ͪͩͲɺ࣮͸DHH
    ͸ for ... in Ͱॻ͍ͯͨʂ

    View full-size slide

  25. treat fullwidth whitespace
    as a blank character
    https:/
    /github.com/rails/rails/
    commit/9c608603

    View full-size slide

  26. treat fullwidth whitespace
    as a blank character
    String#blank? ͕શ֯εϖʔεͱ
    ͔ͦͷଞݟ͑ͳ͍จࣈΛશ෦ۭന
    ѻ͍͢ΔΑ͏ʹ
    ͭ·ΓɺString#blank? ஗ͨ͘͠
    ͷΦϨΦϨ

    View full-size slide

  27. Relation.where with no args can be
    chained with not, like, and not_like
    https:/
    /github.com/rails/rails/
    commit/de75af7a

    View full-size slide

  28. Relation.where with no args can be
    chained with not, like, and not_like
    4छྨͷsyntaxΛ࣮૷ͯ͠ఏҊ
    ࠓͷ where.not() ͷsyntax͸JeremyҊ
    where.like ͱ͔ where.not_like ΋

    ࣮૷͚ͨ͠ͲɺޙʹDHHʹϦόʔτ

    ͞Εͨ

    View full-size slide

  29. tyop
    https:/
    /github.com/rails/rails/
    commit/c7f1bcd2

    View full-size slide

  30. tabenai (typo)
    https:/
    /github.com/rails/rails/
    commit/407baa2b

    View full-size slide

  31. tabenai (typo)
    ͍·ͩʹkamipo͞Μʹݴٴ͞Ε
    Δίϛοτ……

    View full-size slide

  32. Space Oddity
    https:/
    /github.com/rails/rails/
    commit/d9bdb611

    View full-size slide

  33. Space Oddity
    David Bowie͕๢͘ͳͬͨͷͰ͓
    ͔͠ͳεϖʔεΛ୳ͯ͠ίϛοτ

    View full-size slide

  34. Ruby and Rails
    ࣗ෼ͷओͳकඋൣғ͸Rubyͱ
    Railsͷؒͷ͋ͨΓ͔ͳɺͱࢥͬ
    ͯΔͷͰɺͪΐͬͱͦ͜΁Μͷ࿩
    Λ͠·͢ɻ

    View full-size slide

  35. kwargs &
    binding.local_variable_get
    Rails Ͱ࢖ͬͯΈΔ͜ͱͰ :if ͱ͔

    :unless ͱ͍͏ϢʔεέʔεΛൃݟ
    Ruby 2.2͋ͨΓͰ
    binding.local_variable_get Λ

    ಋೖ

    View full-size slide

  36. frozen_string_literal
    https:/
    /bugs.ruby-lang.org/
    issues/8976#change-53900

    View full-size slide

  37. frozen_string_literal
    Railsͷ .freeze ஍ࠈΛղফ͢Δ

    ͨΊʹRubyଆʹಋೖΛఏҊ

    View full-size slide

  38. Refinements
    https:/
    /github.com/rails/rails/
    commit/571f0f32

    View full-size slide

  39. Refinements
    Railsʹಋೖ͠(ͯRubiniusͰಈ͔
    ͳ͘͠)ͨͷΦϨΦϨ

    View full-size slide

  40. require_relative
    ͩ͞͞͞Μʹͦͦͷ͔͞Εͯ
    RailsͰ࢖ͬͯΈͨΒόάͬͯͨ
    Ruby 2.4͙Β͍Ͱमਖ਼

    View full-size slide

  41. protected
    Railsք۾Ͱ΍ͨΒͱޡ༻͞Εଓ
    ͚͖ͯͨػೳ
    ΄΅શͯ private ͷؒҧ͍

    View full-size slide

  42. When you say `protected` in Ruby,
    you might 99% be meaning `private`
    https:/
    /github.com/
    amatsuda/rails/commit/
    6832343c

    View full-size slide

  43. ࣮ࡍͷίϛοτ͸ϥΠϒϥϦ͝ͱʹ

    rdocͷग़ྗ݁ՌΛ֬ೝ͠ͳ͕Β

    View full-size slide

  44. Privatize unneededly protected
    methods in Active Record
    https:/
    /github.com/rails/rails/
    commit/5b14129d
    ͳͲͳͲ

    View full-size slide

  45. ηΩϡϦςΟؔ࿈ύον΋

    ͍͔ͭ͘
    https:/
    /github.com/rails/rails/
    commit/87eab595
    https:/
    /github.com/rails/rails/
    commit/dfa33fa3 ͱͦͷपล
    ͳͲͳͲ

    View full-size slide

  46. ௨Βͳ͔ͬͨఏҊͨͪ

    View full-size slide

  47. Sexier migrations
    https:/
    /github.com/rails/rails/
    pull/1163

    View full-size slide

  48. Sexier migrations
    migrationͷ t. Λ࡟Δ΍ͭ
    t. ཁΒͳ͍ͱࢥ͏Μ͚ͩͲͳ͊

    View full-size slide

  49. automatic client side validation
    with HTML 5 "required" attribute
    https:/
    /github.com/rails/rails/
    pull/3590

    View full-size slide

  50. automatic client side validation
    with HTML 5 "required" attribute
    Ϟσϧʹॻ͍ͨvalidationΛΫϥ
    ΠΞϯταΠυʹ΋൓ө
    2011೥ʹఏҊ
    ࣌୅ΛઌऔΓ͗ͯͯ͢͠ݟૹΒΕ
    ͨ

    View full-size slide

  51. Action Args
    ΞΫγϣϯϝιουʹҾ਺Λ
    ΀ΔΓ͸ग़ͯ͠ͳͯ͘ɺνϟοτͰ
    ఏҊͨ͠ؾ͕͢Δ
    DHHʹେےͰ͸ؾʹೖͬͯ΋Β͑ͨ
    ΋ͷͷɺࡉ͔͍෦෼ͷ࢓༷͕ંΓ߹
    Θͣ٫Լ

    View full-size slide

  52. օ͞Μ͔Βͷ :+1:׻ܴ͠·͢

    View full-size slide

  53. ͜Μͳײ͡ͰɺRailsຊମʹಥͬࠐΉҎ֎ʹ΋ɺ

    ϓϥάΠϯͱ࣮ͯ͠૷͢Δ͜ͱ΋͋Γ·͢

    View full-size slide

  54. ϓϥΪϯ։ൃ

    View full-size slide

  55. i18n_generators

    View full-size slide

  56. i18n_generators
    I18nͷϦιʔεΛਓ͕ؒॻ͔ͳ͘
    ͯΑ͘ͳΔ࠷ߴʹ΂ΜΓͳ΍ͭ
    10೥લʹ࡞ͬͨ΍͚ͭͩͲɺ
    Rails 5.2Ͱະͩʹ࢖͑Δ

    View full-size slide

  57. kaminari
    ϖʔδωʔγϣϯ͢Δ΍ͭ
    Rails 3Ͱಈ͍ͯΔ΋ͷ͕ͳ͔ͬͨ
    ͷͰ࡞ͬͨ
    M, V, Cͷ3ͭͷϨΠϠʔʹ

    ·͕ͨΔػೳ

    View full-size slide

  58. Rails 3ͷ৽ػೳɺRails Engine

    ͬͯ΍ͭͰ࡞ͬͯΈͨͯ͘࡞ͬͨ

    View full-size slide

  59. ͨͿΜੈքͰ2൪໨͙Β͍ʹݹ͍

    ࣮༻ϨϕϧͷEngine

    View full-size slide

  60. action_args
    DHHʹఏҊ͕௨Βͳ͔͚ͬͨͲɺgemͰ
    ͝ར༻͍͚ͨͩ·͢
    Asakusa.rb໊ٛͰϝϯς
    શRailsϓϥάΠϯͷதͰҰ൪޷͖
    ͱ͍͏͔ɺ͜Ε͕ೖͬͯͳ͍ͱRailsΞϓ
    Ϧॻ͚ͳ͍

    View full-size slide

  61. active_decorator

    View full-size slide

  62. active_decorator
    ϔϧύʔॻ͖ͨ͘ͳ͍(ϔϧύʔࢮΜͰ
    ΄͍͠)
    ઌߦϓϩμΫτ͕ͼͬ͘Γ͢Δ͙Β͍
    ϔϘ͔ͬͨͷͰ࢓༷΋࣮૷΋1000ഒ͙
    Β͍Ϛγͳ΍ͭΛࣗ࡞
    OpinionatedͳσβΠϯ

    View full-size slide

  63. OpinionatedͳσβΠϯ
    ࠷ۙͷόʔδϣϯͰ݁ہંΕͨͷ
    Ͱɺ෦෼తʹഊ๺ͨ͠ͱݴ͑Δ

    View full-size slide

  64. html5_validations
    ຊମ΁ͷఏҊ͸௨Βͳ͔͚ͬͨͲ
    gemͰ͝ར༻͍͚ͨͩ·͢
    ϓϥάΠϯ࡞Γͷڭࡐʹͪΐ͏Ͳ
    ͍͍͔΋

    View full-size slide

  65. stateful_enum

    View full-size slide

  66. stateful_enum
    AR֦ுܥ
    ΊͪΌΊͪΌ࣮༻త
    σβΠϯ΋࣮૷΋γϯϓϧͰ៉ྷ
    (ͩͬͨ)

    View full-size slide

  67. erd
    ERਤΛϒϥ΢β্Ͱΰχϣΰ
    χϣ͢ΔEngine
    ඍົʹະ׬

    View full-size slide

  68. Rails Engine͍͍ΑͶ

    View full-size slide

  69. hocus_pocus
    Rails Engineͷݶքʹ௅ઓͨ͠

    ҙཉ࡞
    υΩϡϝϯτ͕օແͳͷͰͨͿΜ

    ࢖͑ͳ͍
    web_consoleΛΠϯεύΠΞͨ͠ͱ
    ͍͏ྺ࢙తҙٛ

    View full-size slide

  70. ͦΖͦΖ·ͱΊ

    View full-size slide

  71. ʮRailsʹ͍ͭͯͷ஌ࣝΛަ׵͠ɺ
    ೔ʑͷ։ൃʹ໾ཱ͍ͯͯ͜͏ʯ

    View full-size slide

  72. ͱ͍͏͜ͱͰɺ೔ʑͷ։ൃͷ࿩
    Λ͠·ͨ͠

    View full-size slide

  73. Railsϓϩάϥϛϯά͸ͨͷ͍͠

    View full-size slide

  74. RailsϓϩάϥϛϯάͰ૲Λ

    ੜ΍ͦ͏ʂ

    View full-size slide

  75. ଓ͖͸࠙਌ձͰʂ

    View full-size slide