# ERB question

**URL:** <https://www.ruby-forum.com/t/erb-question/82667>\
**Category:** Ruby\
**Created:** [March 16, 2006, 6:06pm UTC](https://www.ruby-forum.com/t/erb-question/82667 "2006-03-16T18:06:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_DSLa\_Gesse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d26b3c/32.png) [@Robert\_DSLa\_Gesse](https://www.ruby-forum.com/u/Robert_DSLa_Gesse)\
**Post date:** [March 16, 2006, 6:06pm UTC](https://www.ruby-forum.com/t/erb-question/82667/1 "2006-03-16T18:06:26Z")

</div>

Can anyone tell me what the difference is in these two statements? Yes,  
I’m a newbie!

\<%=h device.send(column.name) %\>

\<%= device.send(column.name) %\>

Specifically, what is the \<%=h supposed to do? The “h” doesn’t appear  
to do anything that I can find, yet RoR generates code using it…

Thanks much!

Rob

---

<div class="post-metadata">

**Author:** ![Robert\_DSLa\_Gesse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d26b3c/32.png) [@Robert\_DSLa\_Gesse](https://www.ruby-forum.com/u/Robert_DSLa_Gesse)\
**Post date:** [March 16, 2006, 6:09pm UTC](https://www.ruby-forum.com/t/erb-question/82667/2 "2006-03-16T18:09:37Z")

</div>

Robert D. La Gesse wrote:

> Thanks much!
> 
> Rob

h is a short form for is a short form for the method html\_escape.

So IMHO it’s more clear to write something like  
\<%= h(device.send(column.name)) %\>

cu

polarix

---

<div class="post-metadata">

**Author:** ![Robert\_DSLa\_Gesse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d26b3c/32.png) [@Robert\_DSLa\_Gesse](https://www.ruby-forum.com/u/Robert_DSLa_Gesse)\
**Post date:** [March 16, 2006, 6:12pm UTC](https://www.ruby-forum.com/t/erb-question/82667/3 "2006-03-16T18:12:45Z")

</div>

On Mar 16, 2006, at 6:03 PM, Robert D. La Gesse wrote:

> Thanks much!
> 
> Rob

See: [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/HowToEscapeHTML)

RoR has it’s own mailing list: [Ruby on Rails — Community](http://rubyonrails.com/community)

– Daniel

---

<div class="post-metadata">

**Author:** ![Robert\_DSLa\_Gesse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d26b3c/32.png) [@Robert\_DSLa\_Gesse](https://www.ruby-forum.com/u/Robert_DSLa_Gesse)\
**Post date:** [March 16, 2006, 6:15pm UTC](https://www.ruby-forum.com/t/erb-question/82667/4 "2006-03-16T18:15:47Z")

</div>

Markus W. wrote:

> > 
> 
> cu
> 
> polarix

OK, I guess that’s clear enough… but it doesn’t actually seem to make  
any difference if the “h” is in there or not. And I can’t seem to  
determine why Ruby on Rails sometimes generates code with the “h”, and  
sometimes it doesn’t 🙂

Thank,

Rob

---

<div class="post-metadata">

**Author:** ![Robert\_DSLa\_Gesse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/d26b3c/32.png) [@Robert\_DSLa\_Gesse](https://www.ruby-forum.com/u/Robert_DSLa_Gesse)\
**Post date:** [March 16, 2006, 6:21pm UTC](https://www.ruby-forum.com/t/erb-question/82667/5 "2006-03-16T18:21:52Z")

</div>

On Mar 16, 2006, at 11:13 AM, Robert D. La Gesse wrote:

> > > Specifically, what is the \<%=h supposed to do? The “h” doesn’t  
> > > polarix  
> > > OK, I guess that’s clear enough… but it doesn’t actually seem to  
> > > make any difference if the “h” is in there or not. And I can’t  
> > > seem to determine why Ruby on Rails sometimes generates code with  
> > > the “h”, and sometimes it doesn’t 🙂

Try:

\<%= h “\< & \>” %\>

and:

\<%= “\< & \>” %\>

James Edward G. II
