How to replace mail_to in Rails 3?

I have just started up grading to Rails 3. mail_to no longer works,
you just get a lot of garbage. With what do I replace it?

Thanks

Paul Thompson

“Paul Jonathan T.” [email protected]
wrote in message
news:[email protected]

I have just started up grading to Rails 3. mail_to no longer works,
you just get a lot of garbage. With what do I replace it?

The mail_to helper is still present in edge Rails, so I’m not sure what
is
going wrong. Can you provide an example of your invocation, and what it
is
outputting?

On 16 April 2010 03:40, Joe S. [email protected] wrote:

outputting?
Hi,

I am using Rails 3 Beta 3. The code is:

<%= mail_to(supplier.email, h(supplier.email), :subject => “Bathroom
Direct Order:”, :encode => “javascript”) %>

This has worked fine up till Rails 2.3.5. Below is what now appears in
the view:

Guidance will be most welcome.

Regards,

Paul

On 15/04/2010 21:27, Paul Jonathan T. wrote:

going wrong. Can you provide an example of your invocation, and what it is

Guidance will be most welcome.

Regards,

Paul

Isn’t that rails obfuscating the mailto link so that parsers cannot
harvest email addresses so easily? Does the mailto link work if you
follow it?

HTH

Matt

Hey Paul,

That javascript looks correct. mail_to should return an html_safe
string. Escaped html indicates it isn’t.

So if the problem is that the html is being escaped, then this is a
bug. file a ticket on the rails lighthouse.

To get around the bug, use <%=raw mail_to(…) %> or <%=
mail_to(…).html_safe %>

Regards
Kieran

Hi Kieran,

Thanks for that. The raw option worked. I will file a ticket on the
rails lighthouse.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs