perfectline / validates_url

URL Validation for Rails
MIT License
579 stars 111 forks source link

Validating with Mustache fails now #105

Open Jeremy1026 opened 4 years ago

Jeremy1026 commented 4 years ago

Validating URLs that include mustache fails as of 1.0.10

with_options({on: :errors}) { |r|
  r.validates :url,   url: true, allow_blank: true, mustache: true
}

http://example.com/{{mustache}}

Fails in 1.0.10, validated in 1.0.8.

kritik commented 4 years ago

I don't think we support attribute mustache

taf2 commented 3 years ago

I created a gist to solve this one https://gist.github.com/taf2/d899dc2de05e6df0727a146159e2563d

You can use the module as:

  include Ctm::UrlWithMustache
  mustache_validated_url :weburl
  validates :weburl, url: {no_local: true}

So little extra code... but ideally it would be a feature of this gem...

  validates :weburl, url: {no_local: true, mustache: :allowed}