Ruby on rails 3 失败;如果;在Rails 3中

Ruby on rails 3 失败;如果;在Rails 3中,ruby-on-rails-3,Ruby On Rails 3,我有一段代码,由于一个奇怪的原因似乎不起作用: <% if (@user.photo.blank?) %> <%= image_tag("empty_profile_pic.png") %> <!-- replace with user's image --> <%else %> <%= image_tag(@user.photo.url(:small)) %>

我有一段代码,由于一个奇怪的原因似乎不起作用:

    <% if (@user.photo.blank?) %>               
        <%= image_tag("empty_profile_pic.png") %> <!-- replace with user's image -->
    <%else %>
        <%= image_tag(@user.photo.url(:small)) %> 
    <% end %>
有什么帮助吗?

怎么样

@user.photo.com存在吗

~Charles~


<%= image_tag(@user.photo.try(:url, :small) || "empty_profile_pic.png") %>

您使用什么插件进行图像处理?卡里尔瓦夫?蜻蜓?回形针?
<%= image_tag(@user.photo.try(:url, :small) || "empty_profile_pic.png") %>