Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validating with Mustache fails now #105

Open
Jeremy1026 opened this issue May 20, 2020 · 2 comments
Open

Validating with Mustache fails now #105

Jeremy1026 opened this issue May 20, 2020 · 2 comments

Comments

@Jeremy1026
Copy link

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
Copy link
Member

kritik commented May 21, 2020

I don't think we support attribute mustache

@taf2
Copy link

taf2 commented Feb 24, 2021

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants