Hi,
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
example,
<%= collection_select(myTag, :product_id,
@products, :id, :description, options ={ :prompt => "select
product"},
{
:onChange=>remote_function(:update=>div_id,:with=>"''id=''+this[this.selectedIndex].value",:url=>{:action=>:list_by_product_id,:tag=>myTag})
}
) %>
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.
thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---