如何在select_tag中使用link_to?像这样......
<%= select_tag "test1","<option>#{link_to 'View Details', view_path(test)}</option><option>#{link_to 'Delete', delete_path(test)}</option><option>#{link_to 'Edit Details', edit_path(test)}</option>"%>
任何解决方案?
答案 0 :(得分:4)
<%= select_tag "test1","<option value='#{view_path(test)}'>View Details</option><option value='#{delete_path(test)}'>Delete</option><option value='#{edit_path(test)}'>Edit Details</option>" ,:onchange => "window.open(this.options[this.selectedIndex].value,'_top')" %>