Home > Back-end >  How to prevent Rails from rendering links when using partials in Mailer
How to prevent Rails from rendering links when using partials in Mailer

Time:10-31

I would like to reuse my partials in mailer layouts, but I want to avoid rendering the hyperlinks and instead print out just their name, like using link_to_if / link_to_unless methods.
Which condition could I check to prevent the rendering all the links inside mailer layouts?

CodePudding user response:

Inside your email view, you can use something like this :

<%= controller.class.name %>

The printed controller name will be a mailer : "ApplicationMailer", ...

You can then Regex or use a string helper ...

  • Related