Eager Load Depending on Type of Association in Ruby on Rails

后端 未结 7 2354
温柔的废话
温柔的废话 2021-02-07 22:13

I have a polymorphic association (belongs_to :resource, polymorphic: true) where resource can be a variety of different models. To simplify the questio

7条回答
  •  难免孤独
    2021-02-07 22:29

    This is now working in Rails v6.0.0.rc1: https://github.com/rails/rails/pull/32655

    You can do .includes(resource: [:address, :location])

提交回复
热议问题