# Html escape with hash options

**URL:** <https://www.ruby-forum.com/t/html-escape-with-hash-options/113161>\
**Category:** Rails\
**Created:** [August 28, 2007, 9:24am UTC](https://www.ruby-forum.com/t/html-escape-with-hash-options/113161 "2007-08-28T09:24:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishvanathan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/c0e974/32.png) [@vishvanathan](https://www.ruby-forum.com/u/vishvanathan)\
**Post date:** [August 28, 2007, 9:24am UTC](https://www.ruby-forum.com/t/html-escape-with-hash-options/113161/1 "2007-08-28T09:24:21Z")

</div>

Hi,

I have some problem in html\_escape function with hash option  
parameters.

I hope that below syntax shows that hash options.

In view.rhtml file.

html\_escape(“Hello”,{:one = \> “true”, :two =\> “false” })

In application\_helper.rb

def html\_escape (s,l=Hash.new )

```
    l.each { |key,value|

         html_escape_newline(s).gsub(/\r\n/,"<br/>")
    }

```

end

alias h html\_escape

I am getting the below error message when I am running the application.

ActionView::TemplateError (private method `gsub’ called for {}:Hash)  
on line  
#1 of app/views/sample/modify.rhtml:  
1: \<% form\_for :text, @text, :url =\> { :action =\> ‘view’} do |f| %\>

Pls give your suggestion to me.

Best Regards,  
Vichu
