Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

35* n /$ .(@expajp) –  &' • 3!2! – Ruby/Rails210, –     -+ – )1#"%( – 6+4

Slide 3

Slide 3 text

       1 1 n n        

Slide 4

Slide 4 text



Slide 5

Slide 5 text

       1 1 n n        

Slide 6

Slide 6 text

       1 1 n n          has_many :through

Slide 7

Slide 7 text

       1 1 n n          has_one :through  has_many :through

Slide 8

Slide 8 text

has_many :through     has_ many belongs_ to       has_ many belongs_ to

Slide 9

Slide 9 text

has_one :through     has_ one belongs_ to has_ one belongs_ to  

Slide 10

Slide 10 text



Slide 11

Slide 11 text



Slide 12

Slide 12 text

    

Slide 13

Slide 13 text

 Matter Contact User

Slide 14

Slide 14 text

  n N+1 Query n     n  matter.main_operator  

Slide 15

Slide 15 text

scope n   '   n 1"&  #   %)!(     n $

Slide 16

Slide 16 text

has_one :through n  through    

Slide 17

Slide 17 text

has_one :through n  through    

Slide 18

Slide 18 text

has_one :through n  through " !   n conditions  -> { where(…) } #  

Slide 19

Slide 19 text

 n ## $( $ % n has_one :through &%!  " n    '   $