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

Joyful user foundation restructuring with Ruby

Joyful user foundation restructuring with Ruby

RubyWorld Conference 2017 での講演資料です。

MOROHASHI Kyosuke

November 01, 2017
Tweet

More Decks by MOROHASHI Kyosuke

Other Decks in Programming

Transcript

  1. “ And there's business value in fun - after all

    motivation is a major factor in programmer productivity. 
 ͦΕ͔Βɺʮָ͠͞ʯʹ΋ϏδωεՁ஋͕͋Γ·͢ŠŠ݁ہɺϞνϕʔγϣϯ ͕ͦ͜ϓϩάϥϚͷੜ࢈ੑΛࠨӈ͢ΔͷͰ͢ɻ https://martinfowler.com/bliki/DynamicTyping.html 
 ( http://bliki-ja.github.io/DynamicTyping/ )
  2. ‣ 10೥લ ‣ rails generate scaffold users
 email:string password_digest:string ‣

    ݱࡏ ‣ ͜Ε·Ͱ࢖ͬͯ͘Ε͍ͯΔϢʔβʔ͞Μʹ໎࿭Λ͔͚ͳ͍Α͏ ஫ҙΛ͸Β͍ͭͭɺϏδωεχʔζͰ͏·Εͨଟछଟ༷ͳ֓೦ ΍σʔλߏ଄Λ੔ཧͯ͠ɺࠓޙͷαʔϏεల։ͷج൫ͱͳΔɻ ؆୯ͳ໰୊͸͋·Γ࢒͍ͬͯͳ͍ 
  3. The Recipe for the World’s Largest Rails Monolith Akira Matsuda

    https://speakerdeck.com/a_matsuda/the-recipe-for-the-worlds-largest-rails-monolith
  4. 

  5. 

  6. “ Regardless of what we discover, we understand and truly

    believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand. ͜ͷձͰ͸ɺϓϩδΣΫτͷશһ͕ஔ͔Εͨঢ়گԼͰϕετΛਚͨ͘͠ɺͱ͍ ͏͜ͱΛٙͬͯ͸ͳΒͳ͍ ฏು༁  http://www.retrospectives.com/pages/retroPrimeDirective.html
  7. ‣ ςετՄೳͳʮϞσϧ૚ʯ͸༗༻ɻ ‣ ʮϓϨθϯςʔγϣϯͱυϝΠϯͷ෼཭ʯͬͯ΍ͭ ‣ ίϯτϩʔϥ͔Β͸ৗʹ who ͱ when ͕౉͞ΕΔɻ

    ‣ ActiveSupport::CurrentAttributes ͳΔ΄Ͳɻ ‣ ͩΜͩΜʮϑΥʔϜʯ͡Όͳ͍͜ͱ΋෼͔͖ͬͯͨɻ ‣ αʔϏεΛʮೖΕࢠʯʹ͍ͨ͜͠ͱ΋͋Δɻ αʔϏε૚ͱͯ͠ͷ Form Object 
  8. ‣ ొ࿥தͷσʔλ͸ ʮ validate: false ͳϢʔβʔʯͰ͸
 ͳ͍ɻ ‣ ొ࿥ͦΕࣗମ΋ҰͭͷେࣄͳػೳͰ͋Δɻ ‣

    Registration ͱ͍͏֓೦Λൃݟͨ͠ɻ ‣ ಉ࣌ʹɺొ࿥ޙʹͪΌΜͱݩͷίϯςΩετʹ໭͢ͷ΋
 ͱͯ΋େࣄͱ͍͏͜ͱ΋ɺֶΜͩɻ ͜Ε·ͰͷϏδωε͔Β΋ֶͿ 
  9. resources :email_registrations, only: %i(show new create) do collection do get

    :thanks end resource :user, controller: :cookpad_users,
 only: %i(show new create), module: :email_registrations end end ‣ &ϝʔϧͰͷϢʔβʔొ࿥ email_registrations ࣗମΛϦιʔεͱͯ͠ѻ͏ɻ ‣ ͔ͦ͜ΒผϦιʔεͱͯ͠Ϣʔβʔ(cookpad_users)Λ࡞Δɻ 
  10. 

  11. 

  12. 

  13. 

  14. 

  15.