Created
July 8, 2014 21:15
-
-
Save sstarr/d8c22575ad38e6c23c0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Profile < ActiveRecord::Base | |
# ... | |
def format_twitter_url | |
unless self.twitter_url.blank? || self.twitter_url[/^https?:\/\//] | |
if self.twitter_url[/twitter\.com/i] | |
self.twitter_url = 'http://' + self.twitter_url | |
else | |
self.twitter_url = "https://twitter.com/#{self.twitter_url.sub(/@/, '')}" | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment