Eager Loading Polymorphic Associations in Ruby on Rails
3 min readOct 27, 2020
For when .includes
is not enough.
Basic Rails Associations
Rails’ ActiveRecord associations permits relating one model to another. Take the example below:
class Post < ApplicationRecord
has_many :comments
endclass Comment < ApplicationRecord
belongs_to :post
end