# Link\_to syntax question

**URL:** <https://www.ruby-forum.com/t/link-to-syntax-question/132302>\
**Category:** Rails\
**Created:** [March 18, 2008, 10:48pm UTC](https://www.ruby-forum.com/t/link-to-syntax-question/132302 "2008-03-18T22:48:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![drsharp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@drsharp](https://www.ruby-forum.com/u/drsharp)\
**Post date:** [March 18, 2008, 10:48pm UTC](https://www.ruby-forum.com/t/link-to-syntax-question/132302/1 "2008-03-18T22:48:24Z")

</div>

Hi, I’m trying to build a simple forum and would like the post topic to  
be a clickable link. What would be the correct syntax to perform this?  
eg.

Placing the value of this:  
\<%= h post.title %\>

Into this, in the place of ‘Title of post’  
\<%= link\_to ‘Title of post’, forum\_posts\_path(@forum) %\>

Any advice appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![drsharp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@drsharp](https://www.ruby-forum.com/u/drsharp)\
**Post date:** [March 18, 2008, 11:34pm UTC](https://www.ruby-forum.com/t/link-to-syntax-question/132302/2 "2008-03-18T23:34:03Z")

</div>

\<%= link\_to h(‘Title of post’), forum\_posts\_path(@forum) %\>

“h” is just a function call

On Mar 18, 2:48 pm, Dan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![drsharp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@drsharp](https://www.ruby-forum.com/u/drsharp)\
**Post date:** [March 18, 2008, 11:37pm UTC](https://www.ruby-forum.com/t/link-to-syntax-question/132302/3 "2008-03-18T23:37:24Z")

</div>

Whenver I put any ruby code in the ''s of link\_to, I get a page full of  
errors…

---

<div class="post-metadata">

**Author:** ![drsharp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@drsharp](https://www.ruby-forum.com/u/drsharp)\
**Post date:** [March 18, 2008, 11:41pm UTC](https://www.ruby-forum.com/t/link-to-syntax-question/132302/4 "2008-03-18T23:41:45Z")

</div>

show me thy code

On Mar 18, 3:37 pm, Dan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
