Rails: includes with polymorphic association

前端 未结 6 690
暗喜
暗喜 2020-12-24 11:55

I read this interesting article about Using Polymorphism to Make a Better Activity Feed in Rails.

We end up with something like

class Activity < A         


        
6条回答
  •  长情又很酷
    2020-12-24 12:07

    This will hopefully be fixed in rails 5.0. There is already an issue and a pull request for it.

    https://github.com/rails/rails/pull/17479

    https://github.com/rails/rails/issues/8005

    I have forked rails and applied the patch to 4.2-stable and it works for me. Feel free to use my fork, even though I cannot guarantee to sync with upstream on a regular basis.

    https://github.com/ttosch/rails/tree/4-2-stable

提交回复
热议问题