Last active
January 5, 2022 11:02
-
-
Save banguyenht/2e531a8e0082b18608e2c117312b38c0 to your computer and use it in GitHub Desktop.
rails joins 3 tables
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 :abc, ->(company_id) { | |
A.joins(b: :c).merge(A.where(company_id: company_id)) if company_id.present? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment