This commit is contained in:
nilsding 2014-12-27 01:22:13 +01:00
parent 9fe8be1db8
commit 88e9d7599d
1 changed files with 8 additions and 0 deletions

View File

@ -33,6 +33,14 @@ class User < ActiveRecord::Base
# validates :website, format: { with: WEBSITE_REGEX } # validates :website, format: { with: WEBSITE_REGEX }
before_save do
self.website = if website.match %r{\Ahttps?://}
website
else
"http://#{website}"
end unless website.blank?
end
def login=(login) def login=(login)
@login = login @login = login
end end