I have these statements in a model:
before_save :add_http
protected
def add_http
if (/^http\:\/\/.+$/.match(url)) == nil
str = "http://" + url
url = str
end
end
I have checked the regex in the console and it appears to be right, but when the 'url' gets saved to the db the "http://" has not been added. Any ideas?