app/models/phccodesnipper/script/url.rb in phccodesnipper-1.0.0 vs app/models/phccodesnipper/script/url.rb in phccodesnipper-1.1.0

- old
+ new

@@ -1,8 +1,17 @@ module Phccodesnipper class Script::Url < ApplicationRecord + # Include Core Validations + phc_domain_regx = URI::regexp(%w(http https)) + # Relationships belongs_to :snippet, class_name: 'Phccodesnipper::Script::Snippet' + + # Form Fields Validation + validates :script_url, + presence: true, + length: { minimum: 5 }, + format: { :with => phc_domain_regx, message: "Please follow this URL format http or https://www.**********.com" } end end