module Twitter module Rails module Helpers def twitter_profile_pic(user, options={}) id = user.respond_to?(:twitter_id) ? user.twitter_id : user begin image_url = Twitter.user(id).profile_image_url rescue image_url = "http://static.twitter.com/images/default_profile_normal.png" end image_tag(image_url, options) end end end end