Skip to content
This repository has been archived by the owner on Jun 30, 2020. It is now read-only.

Commit

Permalink
Fix an exception when viewing a non existent user
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexJWayne committed Mar 5, 2010
1 parent 5233412 commit a035712
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,23 @@ def initialize(username)
blocks[name] = data
end

# user info block
@join_date = blocks['User Info'][0]
@age = blocks['User Info'][1]
@sex = blocks['User Info'][2]
@location = blocks['User Info'][3]
@homepage = blocks['User Info'][4].inner_html.strip
if page.find_first('.//div[contains(@class, "profilemain")]').content.strip =~ /No such user/
@name = "User not found"
else
# user info block
@join_date = blocks['User Info'][0]
@age = blocks['User Info'][1]
@sex = blocks['User Info'][2]
@location = blocks['User Info'][3]
@homepage = blocks['User Info'][4].inner_html.strip

# gaming handles box
@steam = blocks['Gaming Handles'][0].to_s.strip
@xbox_live = blocks['Gaming Handles'][1].to_s.strip
@psn = blocks['Gaming Handles'][2].to_s.strip
@wii = blocks['Gaming Handles'][3].to_s.strip
@xfire = blocks['Gaming Handles'][4].to_s.strip
# gaming handles box
@steam = blocks['Gaming Handles'][0].to_s.strip
@xbox_live = blocks['Gaming Handles'][1].to_s.strip
@psn = blocks['Gaming Handles'][2].to_s.strip
@wii = blocks['Gaming Handles'][3].to_s.strip
@xfire = blocks['Gaming Handles'][4].to_s.strip
end
end

def attributes
Expand Down

0 comments on commit a035712

Please sign in to comment.