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