2012-06-06 9 views
3

특수 색상의 SELECT 태그에서 옵션 중 하나를 선택하고 싶습니다.레일 선택 태그 - 특정 옵션 스타일 설정

레일즈의 f.select 헬퍼와 options_for_select를 사용하여 이것을 수행하는 방법은 무엇입니까? 문서가 options_for_select에 대해 말하기를

<html> 
<head> 
    <style type="text/css"> 
    option.standard {background-color:#FFAAAA} 
    </style> 
</head> 
<body> 
    <select style="width:100px"> 
    <option selected="selected">1</option> 
    <option>2</option> 
    <option class="standard">3</option> 
    <option>4</option> 
    <option>5</option> 
    </select> 
</body> 
</html> 

답변

3

, 당신은 이런 식으로 작업을 수행 할 수 있습니다

options_for_select([ 1, 2, [ 3, { :class => 'standard' }], 4, 5 ], [ 1 ]) 
관련 문제