Sha256: de8f18c89e3ab8c1feed90c640373d59e932322909c68e57729da9fc4a61d5ef
Contents?: true
Size: 289 Bytes
Versions: 3
Compression:
Stored size: 289 Bytes
Contents
module FormatUrl module ModelAdditions def format_url(attribute) before_validation do send("#{attribute}=", FormatUrl.format_url(send(attribute))) end validates_format_of attribute, with: FormatUrl.url_regexp, message: "is not a valid URL" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
format_url-0.0.3 | lib/format_url/model_additions.rb |
format_url-0.0.2 | lib/format_url/model_additions.rb |
format_url-0.0.1 | lib/format_url/model_additions.rb |