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.
List R. (Guest)
on 2005-12-08 04: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
List R. (Guest)
on 2005-12-09 05: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
ara.t.howard (Guest)
on 2005-12-09 06:06
(Received via mailing list)
On Fri, 9 Dec 2005, List R. 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.