Last active
March 23, 2017 07:41
-
-
Save ykyk1218/3b80ac636f051596f6eec816b56ee82e to your computer and use it in GitHub Desktop.
railsのscopeでA→B→Cの関連テーブルでCの条件で絞り込みたい時
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :condition, -> { | |
joins(B: :C).where(C: {C_column: "hoge"}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment