开发者

User hash output is showing up in the HTML? Have picture to explain

UI designer newbie here.

Not sure how it got there or how to remove the data coming from the images or users, but whenever I display users in this format.

<%= @users.each do |user| %>
            <div><%= image_tag user.avatar.url(:small), :class => "shadow fluid" %></div>
        <% end %>

I get this user hash info, like this:

User:0x34a8c80>#<User:0x34a015c>#<User:0x34a00bc>#<User:0x34a001c>#<User:0x349ff7c>

I appr开发者_JAVA技巧eciate any help in advance, the log doesn't have anything out of the ordinary, let me know if you need any of my controller info, but its just ordinary stuff, since I'm a newbie.

Also I'm using paperclip to display the images.

Thanks, Matthew


remove "=" sign

<% @users.each do |user| %>
  <div><%= image_tag user.avatar.url(:small), :class => "shadow fluid" %></div>
<% end %>

and a suggestion: check if avatar exist before showing it

<% @users.each do |user| %>
  <% if user.avatar.exists? %>
    <div><%= image_tag user.avatar.url(:small), :class => "shadow fluid" %></div>
  <% end %>
<% end %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜