# Problem with helper form\_tag syntax

**URL:** <https://www.ruby-forum.com/t/problem-with-helper-form-tag-syntax/48828>\
**Category:** Rails\
**Created:** [November 25, 2005, 12:03pm UTC](https://www.ruby-forum.com/t/problem-with-helper-form-tag-syntax/48828 "2005-11-25T12:03:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![andi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@andi](https://www.ruby-forum.com/u/andi)\
**Post date:** [November 25, 2005, 12:03pm UTC](https://www.ruby-forum.com/t/problem-with-helper-form-tag-syntax/48828/1 "2005-11-25T12:03:41Z")

</div>

Hi,

the Rails book says i can use something like this in my view

\<%= form\_tag :action =\> :new, {:class =\> ‘more’} %\>

This gives an syntax error, whereas only this (ugly looking) works:

\<%= form\_tag( {:action =\> :new} , {:class =\> ‘more’} ) %\>

some ruby syntax stuff i get wrong here?

Best  
Andi

---

<div class="post-metadata">

**Author:** ![andi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@andi](https://www.ruby-forum.com/u/andi)\
**Post date:** [November 25, 2005, 4:22pm UTC](https://www.ruby-forum.com/t/problem-with-helper-form-tag-syntax/48828/2 "2005-11-25T16:22:45Z")

</div>

AFAIK, Ruby collects any hash parameters at the _end_ of the argument  
list into a hash. So,

\<%= form\_tag {:action =\> :new}, :class =\> ‘more’ %\>

may work. On the other hand, IIRC, it is considered deprecated to  
omit the parentheses on functions in views now. You would probably  
get a warning on the above. So the ‘minimalist’ correct ERb code  
would probably look like this:

\<%= form\_tag( {action =\> :new}, :class =\> ‘more’ ) %\>

–  
Brad E.  
866-EDIGERS

---

<div class="post-metadata">

**Author:** ![andi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@andi](https://www.ruby-forum.com/u/andi)\
**Post date:** [November 25, 2005, 8:21pm UTC](https://www.ruby-forum.com/t/problem-with-helper-form-tag-syntax/48828/3 "2005-11-25T20:21:27Z")

</div>

Hey Brad,

thanks for clarifying this.

-andi
