Eager Loading on Rails 5.1
Hi all,
Seems that the eager loding doen't work in my application. Please let me know whether I need to enable or configure anything. Here is th code for association mappings.
class Event < ApplicationRecord
has_many :receipts, dependent: :destroy
has_many :receipt_happenings, through: :receipts
has_many :receipt_amounts, through: :receipt_happenings, source: :paper_money
end
I could see that the query is running while Iteraing the result set coming from
Event.includes(receipts: {receipt_happenings: :paper_money})
What's the issue you're facing? Is that you're noticing N+1 queries when you loop over events? Or something else?