Collect_select conditional options={}


I’m trying to use a partial that acts as both the edit a view for my
application. within this partial I have a collect_select, for

<%= collection_select(myTag, :product_id,
@products, :id, :description, options ={ :prompt => “select product”},
) %>

When rendering the partial for a new record item I want it to display
“select product”, however when displaying an existing item then to
simply show it in the list without “select product” - if I remove
options ={ :prompt => “select product”} when showing an existing saved
item the select list will default to the correct item.

So, can I conditionally set options ={ :prompt => “select product”}
within the code? So far I’ve not found a way without getting sytax
errors; I thought something like;

<% if product.new_record? %>

but I just don’t know how to get all the sytax right.

any help would be appreciated.