Hi all, In my application all users have the ability to upload a profile picture through a file field but it is not compulsory.
On my index page it displays all users along with their profile pictures but not all users have a profile picture and therefore some users have no image at all. How would I go about getting a generic image to display for the rest of the users. I have the following section in the index: <% for user in @users %> <tbody> <td align = "center"><%= image_tag user.photo.url, :height => 50, :width => 50 %></td> <td align = "center"><%= user.username %></td> <td align = "center"><%= user.favourite_console %></td> <td align = "center"><%= user.games.count %></td> <td align = "center"><%= link_to "Show", user %></body> </tbody> <% end %> For the following line I want to do something like this: If user has photo <td align = "center"><%= image_tag user.photo.url, :height => 50, :width => 50 %></td> else display this photo end How would I go about doing this? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.