I’ve added custom attachments to Action Text following this tutorial by Chris Oliver: https://railsconf.com/2020/video/chris-oliver-advanced-actiontext-attaching-any-model-in-rich-text
I now have Basecamp-style @mentions in my action texts.
The issue I’m running into is that Action Text calls to_partial_path
on the user model when rendering these embedded action texts. However, I want these @mentions to be rendered differently from other parts of my site where I call render @user
(which also calls to_partial_path
).
I find it surprising that Action Text assumes people want to render their models the same way in these different instances. Is there a way to have Action Text use a different partial when rendering its HTML?
Note that I’m not talking about rendering the attachment within the Trix editor. Because that’s indeed already possible through to_trix_content_attachment_partial_path
I’m also aware I could simply change my existing render calls (render @user
, etc) to use a specific partial. But that seems backwards.