2015-06-19 109 views
1

很簡單: 我想打一個<img> -Tag如果我的文件的媒體類型是圖像多個邏輯或運算翡翠

case comment.fileType 
    when "image/png" || "image/gif" || "image/jpeg" 
    img(src="/files/#{comment.fileLink}") 

不起作用

它爲PNG,但不適用於jpeg或gif。 有沒有一招?

回答

0

我認爲這將工作:

case comment.fileType 
    when "image/png" 
    when "image/gif" 
    when "image/jpeg" 
    img(src="/files/#{comment.fileLink}") 
+0

它,謝謝! –