Rails 2.02 collection_select problem passing option and html_option hashes

Running into a strange issue and was wondering if others are experiencing it with the latest rails release.

When using the collection_select helper and passing in a hash for the options or html_options params I consistently get the following error: syntax error, unexpected '}', expecting ')'

Not using a hash to pass the params works fine (for options at least, html_options doesn't seem to).

Let's assume the following: Object to update: @product Methods to update: category_id Collection to pick from: @categories Category value field: id Category text field: name

So this works and will give us the first option "Please select" in the drop down (due to prompt): collection_select( :product, :category_id, @categories, :id, :name, :prompt => true )

However, changing the options param to a hash like this: collection_select( :product, :category_id, @categories, :id, :name, {:prompt => true} )

Breaks the form producing this error. syntax error, unexpected '}', expecting ')'

The following attempts break it too: collection_select( :product, :category_id, @categories, :id, :name, {} ) collection_select( :product, :category_id, @categories, :id, :name, {}, {} ) collection_select( :product, :category_id, @categories, :id, :name, {}, {:onchange => "alert('hi')"} )

Out of ideas.

Dave Rapin wrote:

When using the collection_select helper and passing in a hash for the options or html_options params I consistently get the following error: syntax error, unexpected '}', expecting ')'

I'm sure this will be of no use to you, but I just stuck:

    <%= collection_select :user, :articles, @articles, :id,                           :title, {:prompt => true},                           {:onchange => "alert('hi')"} %>

into one of my views and it worked just fine, popup alert and all.

Rails 2.0.2 on MacOS 10.5.1, ruby 1.8.6

Very strange. Ok thanks. You're on the latest rails release or on edge? Maybe it's a haml problem for me then.

Nevermind. I see you're on 2.02 same as me. Ok thanks for the update. Gotta be something else.