Problem with helper form_tag syntax

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

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

Hey Brad,

thanks for clarifying this.

-andi