0

选择标签:-

<%=select_tag "names",options_from_collection_for_select(@users,"id","name",@user.id)%>

现在我的下拉列表看起来像这样:-

john
matt
sara

但我想拥有它: -

 john edit
 matt edit
 sara  edit

其中“编辑”是可以编辑特定用户的链接。但我无法将链接放入 select_tag。

谢谢

4

1 回答 1

3

There's no way to do this in Rails out of the box - this is rather uncommon task. Yet I see two options here:

  1. use solutions like this;
  2. find yourself a suitable jQuery plugin like this. Most of them will turn the select tag into divs, which can be further customized.
于 2012-05-22T11:36:17.587 回答