Skip to content

Commit 20a613e

Browse files
committed
Hacker pages now show gravatars.
1 parent b48c24c commit 20a613e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

models/hacker.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ def self.authenticate(username, pass)
5757
def admin?
5858
return self.admin == true
5959
end
60-
60+
61+
#a helper function for gravatar urls
62+
def gravatar_url
63+
require 'md5'
64+
"http://www.gravatar.com/avatar/#{MD5::md5(email.downcase)}"
65+
end
6166

6267
private
6368

views/hackers/show.haml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
%p= @hacker.username + "'s page"
2+
%p
3+
%img{:src => @hacker.gravatar_url}
24

35
- if logged_in?
46
%a{:href => "/messages/new/to/#{@hacker.username}" }= "Send #{@hacker.username} a message"

0 commit comments

Comments
 (0)