I’ve added custom attachments to Action Text following this tutorial by Chris Oliver: RailsConf 2020
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
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
I’m also aware I could simply change my existing render calls (
render @user, etc) to use a specific partial. But that seems backwards.