alt条件显示

[code="java"]

snapshot = (vmc) ? "#{vmi.uuid}.jpg" : "no_con.jpg"

        <%=link_to_if(vmi.status == "running",
                      image_tag(snapshot, 
                                :alt => t(snapshot.split(".")[0]) ,
                                :width =>270, :height => 180 ),
                                "vnc://#{vmc_addr}:#{vmi.vnc_port}") %>

[/code]

现在有上面这么一段代码(在一个.rhtml文件里),我想条件显示image_tag的alt,即:
当snapshot.split(".")[0]为vmi.uuid时,我不显示alt,
当snapshot.split(".")[0]为no_con时,我显示alt,
如果加个条件判断,应该怎么写?
我试了:alt => t(snapshot.split(".")[0]) if snapshot.split(".")[0] == "no_con"
但是不行。。。有什么方法吗?

[code="ruby"]:alt => t(snapshot.split(".")[0] == "no_con" ? "" : t(snapshot.split(".")[0][/code]

用AJAX判断。