我想添加一個類(「具有版本)一個選項元素在我的選擇標籤取決於選擇的項目。我怎麼可以添加類?類添加到一個選項options_from_collection_for_select
= select_tag 'project_version_id', "<option value='' disabled>-optional select version-</option>".html_safe + options_from_collection_for_select(current_user.current_project.project_versions, :id, :name, @test_case.script.try(:project_version_id))
我需要它是這樣的:
<select name="project_version_id" id="project_version_id">
<option disabled="" value="">-optional select version-</option>
<option selected="selected" value="19">NOOB SAIBOT</option>
<option class="has-versions" value="20">PEW PEW</option>
</select>
讓自己的助手,生成選項 – fl00r 2011-03-21 09:38:51