Skip to content

Instantly share code, notes, and snippets.

@chrislerum
Last active November 25, 2017 02:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrislerum/e4cd28710f0b092da02786e231e4bc91 to your computer and use it in GitHub Desktop.
Save chrislerum/e4cd28710f0b092da02786e231e4bc91 to your computer and use it in GitHub Desktop.
Shouldn't includes give different sql?
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`"
class Supplier < ApplicationRecord
has_many :supplier_results
end
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