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

Railsのための負債の減らし方

alpaca-tc
September 27, 2016
360

 Railsのための負債の減らし方

alpaca-tc

September 27, 2016
Tweet

Transcript

  1. RailsͷͨΊͷ
    ෛ࠴ͷݮΒ͠ํ
    @alpaca-tc

    View full-size slide

  2. @alpaca-tc
    @alpaca_tc
    ❤ Vim, Ruby,
    ͍ͬ͘Μ@pixiv

    View full-size slide

  3. ΋ͷͮ͘Γ͕΋ͬͱָ͘͠ͳΔΞΠςϜ࡞੒αʔϏε
    pixivFACTORY
    ը૾1ຕ͔Β 40छͷ

    άοζɾಉਓࢽ
    ॳظඅ༻0

    ΦϯσϚϯυൢച
    2015.02.05-

    View full-size slide

  4. ΋ͷͮ͘Γ͕΋ͬͱָ͘͠ͳΔΞΠςϜ࡞੒αʔϏε
    pixivFACTORY
    Rails
    2015.02.05-
    JavaScript Go Blender
    Controllers 93 ϑΝΠϧ

    Models 304 ϑΝΠϧ

    table 70+

    View full-size slide

  5. ෛ࠴͕େ͖͍΄Ͳฦࡁ͕େม

    View full-size slide

  6. ෛ࠴͕େ͖͍΄Ͳฦࡁ͕େม
    ෛ࠴͸খ·Ίʹฦ͢ํ͕ྑ͍

    View full-size slide

  7. RailsͷΞοϓάϨʔυ

    View full-size slide

  8. খ·Ίʹෛ࠴ΛݮΒͯ͠
    ָʹRailsΞοϓσʔτ

    View full-size slide

  9. ෛ࠴ΛݮΒ͢3ͭͷίπ

    View full-size slide

  10. 1. ίʔυΛॻ͔ͳ͍

    View full-size slide

  11. ίʔυ͕গͳ͍΄Ͳ
    Ξοϓσʔτ͸ָʹͳΔ

    View full-size slide

  12. YAGNI
    You
    Ain’t
    Gonna
    Need It

    View full-size slide

  13. ػೳ͸ඞཁʹͳΔ·Ͱ௥Ճ͠ͳ͍
    ʮίʔυΛૉૣ࣮͘૷͢ΔͨΊ
    ͷ࠷΋ྑ͍ํ๏͸ɺ͋·Γίʔ
    υΛॻ͔ͳ͍͜ͱʯ

    View full-size slide

  14. ෆཁʹͳͬͨίʔυ͸
    ΨϯΨϯফ͍ͯ͘͠

    View full-size slide

  15. Rails Way
    CoC / DRY

    View full-size slide

  16. ”Կ͔Λͳ͢͏͑Ͱ࠷ળͷํ๏ͱ
    ͍͏΋ͷ͕1͚ͭͩ͋Δ”
    कΕ͹ίʔυ͸খ͘͞ͳΔ

    View full-size slide

  17. 2. Ξοϓσʔτ͸খ·Ίʹ

    View full-size slide

  18. Rails 5
    dateΧϥϜʹɺҰ෦ۭനͷ೔෇Λpost͢Δ
    Ͳ͏ͳΔͰ͠ΐ͏ʁ
    record.update(params.permit(:date))

    View full-size slide


  19. record.update(params.permit(:date))
    NoMethodError: undefined method `in_time_zone' for 0:Fixnum

    View full-size slide

  20. ීஈ͔Βɺߋ৽Λࡉ͔͘backport͢Δ
    config/initializers/rails51_backport.rb
    backport͢Δ
    5.0-stable΋όά͍ͬͯΔɻ(#25834, #25146, #25364…etc)
    ৽ػೳ΋͍ΕΔͱόʔδϣϯΞοϓָ͕ (#25991ͳͲ)
    ʮThis Week in RailsʯͷRSSʹྲྀΕͨมߋΛ
    খ·ΊʹೖΕΔͱྑ͍

    View full-size slide

  21. 3. ةͳ͍ίʔυΛݕ஌

    View full-size slide

  22. if Rails.gem_version >= Gem::Version.new('5.0.0')
    ActiveSupport::Deprecation.warn('廃止予定')
    raise('要チェック')
    ίʔυʹຒΊࠐΉ

    View full-size slide

  23. if Rails.gem_version >= Gem::Version.new('5.0.0')
    ActiveSupport::Deprecation.warn('廃止予定')
    raise('要チェック')
    ίʔυʹຒΊࠐΉ
    ɾRailsΛϋοΫ͍ͯ͠ΔՕॴ
    ɾෛ࠴ͷՕॴ
    ɾ࣍ظόʔδϣϯͰಈ͔ͳ͘ͳΔՕॴ

    View full-size slide

  24. ෛ࠴ΛೝࣝͰ͖Δ
    RailsͷόʔδϣϯΛ্͛Δ࣌ʹ
    ࣮֬ʹฦࡁ͞ΕΔ

    View full-size slide

  25. pixivFACTORY͸
    1೔+ͰऴΘΓ·ͨ͠

    View full-size slide

  26. ීஈ͔Βෛ࠴ΛݮΒͯ͠
    ։ൃʹूத͠·͠ΐ͏

    View full-size slide

  27. ΤϯδχΞืूதʂ

    View full-size slide