Permalink
Browse files

Fixed gravatar when user.email doesn't exist

Fixed antiquoated reference to page_count
  • Loading branch information...
1 parent c92ed35 commit 526e9384a6c3f651369b040481f77cb3df8bef51 @wbharding committed Nov 6, 2009
Showing with 6 additions and 2 deletions.
  1. +1 −1 app/views/forums/show.html.erb
  2. +5 −1 lib/savage_beast/application_helper.rb
@@ -35,7 +35,7 @@
<%= '{count} post(s)'[(count=@forum.posts.size)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %>
</p>
-<% if @topics.page_count > 1 -%>
+<% if @topics.total_pages > 1 -%>
<% if logged_in? %>
<p style="float:right; margin-top:0;"><%= link_to 'New topic'[], new_forum_topic_path(@forum), :class => "utility" %></p>
<% end %>
@@ -19,7 +19,11 @@ def ajax_spinner_for(id, spinner="spinner.gif")
end
def avatar_for(user, size=32)
- image_tag "http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&rating=PG&size=#{size}", :size => "#{size}x#{size}", :class => 'photo'
+ begin
+ image_tag "http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.md5(user.email)}&rating=PG&size=#{size}", :size => "#{size}x#{size}", :class => 'photo'
+ rescue
+ image_tag "http://www.gravatar.com/avatar.php?rating=PG&size=#{size}", :size => "#{size}x#{size}", :class => 'photo'
+ end
end
def beast_user_name

0 comments on commit 526e938

Please sign in to comment.