2
나는 모두와 그림과 같은 도우미 cycle
사용하여 테이블 행의 스타일을 시도하고있다 : 나는이 작업을 수행 할 때할당 여러 CSS 클래스
<tr class= <%= cycle("list-line-odd #{row_class(item)}", "list-line-even #{row_class(item)}")%> >
그러나
, 결과 HTML은 :
<tr class = "list-line-odd" lowest-price>
도우미 방법을 통한 반품은 따옴표로 묶지 않아 인식되지 않습니다. 여기
내가 사용하고 도우미입니다 :def row_class(item)
if item.highest_price > 0 and item.lowest_price > 0 and item.highest_price != item.lowest_price
if item.current_price >= item.highest_price
"highest-price"
elsif item.current_price <= item.lowest_price
"lowest-price"
end
end
end
내가 뭔가를 분명 실종해야하지만, 난 그냥주기의 결과와 같은에서 도우미 메서드 반환 모두를 포장하는 방법을 알아낼 수 없습니다 따옴표 세트. 어떤 도움이라도 대단히 감사하겠습니다!
그건 속임수 였어! 그걸 가장 깨끗하게 보았으므로 두 번째 옵션으로갔습니다. 도와 주셔서 감사합니다! –