Monday, December 13, 2010

default value for select tag

<%= select_tag "neighborhood_id", options_from_collection_for_select(@neighborhoods, "id", "name",65).here 65 is the id of default neighborhood to be displayed in select tag
http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-options_from_collection_for_select

No comments:

Post a Comment