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.

Comments

Popular posts from this blog

Install Cpanm module error : No such file or directory opening compressed index

How to increase Elasticsearch Shard recovery Speed

Getting started with Python Flask application with MVC structure