這裏這段代碼:爲什麼這個嵌入式ruby代碼沒有評估?
<%= case event.subject.value
when 1
puts " upvoted"
when -1
puts " downvoted"
when 0
puts " removed a vote from"
end %>
不會導致任何字符串被渲染。爲了防止event.subject.value
與1,-1或0的值不同,我嘗試添加else
語句,但代碼仍然評估爲空。該代碼不引發錯誤...