Monday, August 30, 2010

select box Send Id, display name..

Hi,

used this to send the ID in params & display name in the select box.

select_tag "user", options_from_collection_for_select(User.all, :id, :name)

For adding option & showing selected params,

select_tag "user_id", "<option>select one</option>" + options_from_collection_for_select(User.all, :id, :name, params[:user_id].to_i)

--
sri.

No comments: