yolk/valvat

undefined method `exists?' for #<Valvat XXX>

markovanderpuil opened this issue · 2 comments

valvat (0.9.1) lib/active_model/validations/valvat_validator.rb:46:in `vat_exists?'

What I'm trying to accomplish is this:

  • blank is allowed
  • if the country property (which contains the ISO code) is in the EU
    • it should check if the countries match
    • and do a lookup

So EU countries are matched and lookupped and other countries are allowed as well without lookup

validates :taxid, valvat: {match_country: :country, lookup: true, allow_blank: true, if: :eu?}

yolk commented

First: Thanks for the report!

This is very strange and I am not able to reproduce the problem.

Could you post the complete stack trace? What versions of activerecord and ruby are you using?

this error occurs when using ", require: 'valvat/local'" in gemfile as

gem 'valvat', require: 'valvat/local'

removing require clause will remove the error ... Made me scratch my head for some time.