Forum: Ruby on Rails Rendering text in a controller, converting to html

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2005-12-08 03:57
I'd like to use render :text => h('this text should be html escaped so
that things like <hi> are still printed!')

How do I do this?  I assume I just need to require a file in the
controller, but I'm not sure what
Ccfe7d097475a32dc3ff78d6fc42c852?d=identicon&s=25 List Recv (lstrecv)
on 2005-12-09 04:15
Do I need to specify more information?
Is something I wrote unclear?

I can't beleive that this is a stumper!

lstrecv wrote:
> I'd like to use render :text => h('this text should be html escaped so
> that things like <hi> are still printed!')
>
> How do I do this?  I assume I just need to require a file in the
> controller, but I'm not sure what
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 ara.t.howard (Guest)
on 2005-12-09 05:06
(Received via mailing list)
On Fri, 9 Dec 2005, List Recv wrote:

>> controller, but I'm not sure what
require 'cgi'

CGI::escapeHTML '<h1> foobar </h1>'

will work...

-a
--
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy.  all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================
This topic is locked and can not be replied to.