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

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

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

52d23923724e1a50fb251d2a0ea122a9?s=128

Shu OGAWARA

April 12, 2018
Tweet

Transcript

  1. 2018/04/12 Otemachi.rb#5 has_one :through Shu OGAWARA (@expajp)

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

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

    n        
  4. 

  5.        1 1 n

    n        
  6.        1 1 n

    n          has_many :through
  7.        1 1 n

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

          has_ many belongs_ to
  9. has_one :through     has_ one belongs_ to

    has_ one belongs_ to  
  10. 

  11. 

  12.     

  13.  Matter Contact User

  14.   n N+1 Query n    

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

    #   %)!(     n $
  16. has_one :through n  through    

  17. has_one :through n  through    

  18. has_one :through n  through " !   n

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

     " n    '   $