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

【2018/04/12 Otemachi.rb#5】has_one :throughの憂鬱

【2018/04/12 Otemachi.rb#5】has_one :throughの憂鬱

2018/04/12 Otemachi.rb#5での発表資料です。

Shu OGAWARA

April 12, 2018
Tweet

More Decks by Shu OGAWARA

Other Decks in Technology

Transcript

  1. 35* n /$ .(@expajp) –  &' • 3!2! –

    Ruby/Rails210, –     -+ – )1#"%( – 6+4
  2.        1 1 n

    n        
  3.        1 1 n

    n        
  4.        1 1 n

    n          has_many :through
  5.        1 1 n

    n          has_one :through  has_many :through
  6. has_many :through     has_ many belongs_ to

          has_ many belongs_ to
  7.   n N+1 Query n    

    n  matter.main_operator  
  8. scope n   '   n 1"& 

    #   %)!(     n $
  9. has_one :through n  through " !   n

    conditions  -> { where(…) } #  
  10.  n ## $( $ % n has_one :through &%!

     " n    '   $