如何在下拉菜单中将每个选项与关联simple_form调用相关联?

我使用simple_form插件有这个表单:

 true) do |f| %>  @video.comment_titles, :label => "Comment Title:", :include_blank => false %>  false, :placeholder => "Post a comment." %>  "Post" %>  

这将创建一个包含此行的下拉列表:

  @video.comment_titles, :label => "Comment Title:", :include_blank => false %> 

我的问题是你如何修改这段代码,以便每个下拉项目都是每个comment_title的个人展示视图的链接?

UPDATE

这是从第一个答案的代码生成的html:

  #<CommentTitle:0x10353b890>">#<CommentTitle:0x10353b890> #<CommentTitle:0x1035296e0>">#<CommentTitle:0x1035296e0> #<CommentTitle:0x1035295a0>">#<CommentTitle:0x1035295a0>  

我实际上弄清楚了。 这是ruby代码:

 <%= f.association :comment_title, :collection => @video.comment_titles.map {|ct| [ct.title, comment_title_path(ct)] }, :label => "Comment Title:", :include_blank => false %> 

这会将数组中的第一个元素作为文本传递,将数组中的第二个元素作为值传递。 然后我使用这个jQuery代码:

 $("select").change(function () { var url = $("select option:selected").val(); $(location).attr("href",url); }); 

很简单。

try :collection => @video.comment_titles.map {|ct| [ct, (link_to ct, comment_title_path(ct))] } :collection => @video.comment_titles.map {|ct| [ct, (link_to ct, comment_title_path(ct))] }