FIX: support 10 characters tld for user profile website

This commit is contained in:
Arpit Jalan 2016-05-25 22:29:47 +05:30
parent fe42b189c9
commit 58ceecd47b

View File

@ -1,7 +1,7 @@
class UserProfile < ActiveRecord::Base
belongs_to :user, inverse_of: :user_profile
WEBSITE_REGEXP = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,9}(([0-9]{1,5})?\/.*)?$)/ix
WEBSITE_REGEXP = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(([0-9]{1,5})?\/.*)?$)/ix
validates :bio_raw, length: { maximum: 3000 }
validates :website, format: { with: WEBSITE_REGEXP }, allow_blank: true, if: Proc.new { |c| c.new_record? || c.website_changed? }