Last active
November 25, 2017 02:01
-
-
Save chrislerum/e4cd28710f0b092da02786e231e4bc91 to your computer and use it in GitHub Desktop.
Shouldn't includes give different sql?
This file contains hidden or 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
irb(main):001:0> Supplier.all.to_sql | |
"SELECT `suppliers`.* FROM `suppliers`" | |
irb(main):002:0> Supplier.includes(:supplier_results).to_sql | |
"SELECT `suppliers`.* FROM `suppliers`" |
This file contains hidden or 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
class Supplier < ApplicationRecord | |
has_many :supplier_results | |
end |
This file contains hidden or 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
class SupplierResult < ApplicationRecord | |
belongs_to :supplier | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment