Skip to content

Instantly share code, notes, and snippets.

@chrislerum

chrislerum/Supplier.rb

Last active Nov 25, 2017
Embed
What would you like to do?
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