I've got select box with users in Rails. Is there any simple way, how to get selected instance from that selectbox?
show.html.erb:
<select id="user_select" name="user_select" class="input-medium">
<% @users.each do |user| %>
<option><%= user.username %></option>
<% end %>
</select>
<!-- button to addfriend method like on next example -->
In this time, I've got something like this on this place:
<ul id="user_list" name="user_list">
<% @users.each do |user| %>
<li><%= user.username %></li>
<%= link_to "Add", addfriend_project_path(@project, :user_id => user.id) %>
<% end %>
</ul>
And I need to get some user info from that selectbox for my method -> id will be the best.