Totally in support of this as well. I've probably made this mistake more often
than I've done it correctly, and it's so easy to miss.

I've seen email templates go months without this being caught.

I'd probably prefer the exception route myself, just by undefining the methods
for ActionMailer.

Caleb

On Thu, Jun 12, 2014 at 12:58:28PM -0500, richard schneeman wrote:
>  Here's a change in behavior I would love on the mailers.
>
> ## Backstory
>
> When you send an email, you'll likely need links. Those links must be the
> full path i.e. 'http://example.com/foo' instead of relative (just '/foo').
> Unfortunately most devs are so used to using the *_path helpers, they use
> them in emails by mistake.
>
> I made this mistake recently with http://www.codetriage.com, here's the PR
> that fixes it (https://github.com/codetriage/codetriage/pull/257). The sad
> part is I didn't realize there was a problem until a user got an email and
> couldn't click on a link. Then they had to be nice enough to report it. If
> your business is running on Rails, this may take days. I've been doing this
> for years, and it still happens to me.
>
>
> ## Feature
>
> Here's what I would like to see happen. Either raise an exception when
> *_path helpers are used in a mail template so my tests would have caught
> it, or likely just have *_path helpers resolve to the full URL by default.
> What do you think?
>
>
> --
> Richard Schneeman
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.

Attachment: pgp0QEXqi0XQ6.pgp
Description: PGP signature

Reply via email to