From 88e9d7599df316c6e5e1de8b50ca3e8242dcd60c Mon Sep 17 00:00:00 2001 From: nilsding Date: Sat, 27 Dec 2014 01:22:13 +0100 Subject: [PATCH] dragons --- app/models/user.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/models/user.rb b/app/models/user.rb index b89dddcd..c202d696 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -33,6 +33,14 @@ class User < ActiveRecord::Base # 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) @login = login end