perfectline / validates_url

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

Seems to work ok when running in the server but I get ArgumentError when using it in the console. #68

Open HenryHaller opened 6 years ago

HenryHaller commented 6 years ago

I'm using this gem on a model called show and it seems to work normally in the server. But when I run Show.where(title: 'asdf') in the console I get ArgumentError: Unknown validator: 'UrlValidator' . I'm using validate_url-1.0.2 and Rails 5.2. Any advice?

HenryHaller commented 6 years ago

here are the gems I am using: ➜ $ bundle install
Using rake 12.3.1 Using concurrent-ruby 1.0.5 Using i18n 1.1.0 Using minitest 5.11.3 Using thread_safe 0.3.6 Using tzinfo 1.2.5 Using activesupport 5.2.1 Using builder 3.2.3 Using erubi 1.7.1 Using mini_portile2 2.3.0 Using nokogiri 1.8.4 Using rails-dom-testing 2.0.3 Using crass 1.0.4 Using loofah 2.2.2 Using rails-html-sanitizer 1.0.4 Using actionview 5.2.1 Using rack 2.0.5 Using rack-test 1.1.0 Using actionpack 5.2.1 Using nio4r 2.3.1 Using websocket-extensions 0.1.3 Using websocket-driver 0.7.0 Using actioncable 5.2.1 Using globalid 0.4.1 Using activejob 5.2.1 Using mini_mime 1.0.1 Using mail 2.7.0 Using actionmailer 5.2.1 Using activemodel 5.2.1 Using case_transform 0.2 Using jsonapi-renderer 0.2.0 Using active_model_serializers 0.10.7 Using arel 9.0.0 Using activerecord 5.2.1 Using mimemagic 0.3.2 Using marcel 0.3.2 Using activestorage 5.2.1 Using public_suffix 3.0.3 Using addressable 2.5.2 Using execjs 2.7.0 Using autoprefixer-rails 9.1.4 Using bcrypt 3.1.12 Using bindex 0.5.0 Using msgpack 1.2.4 Using bootsnap 1.3.1 Using rb-fsevent 0.10.3 Using ffi 1.9.25 Using rb-inotify 0.9.10 Using sass-listen 4.0.0 Using sass 3.5.7 Using bootstrap-sass 3.3.7 Using bundler 1.16.4 Using byebug 10.0.2 Using coderay 1.1.2 Using orm_adapter 0.5.0 Using method_source 0.9.0 Using thor 0.20.0 Using railties 5.2.1 Using responders 2.4.0 Using warden 1.2.7 Using devise 4.5.0 Using dotenv 2.5.0 Using dotenv-rails 2.5.0 Using sassc 1.12.1 Using font-awesome-sass 5.0.13 Using multi_json 1.13.1 Using jbuilder 2.7.0 Using listen 3.0.8 Using pg 0.21.0 Using pry 0.11.3 Using pry-byebug 3.6.0 Using pry-rails 0.3.6 Using puma 3.12.0 Using rack-proxy 0.6.4 Using sprockets 3.7.2 Using sprockets-rails 3.2.1 Using rails 5.2.1 Using redis 4.0.2 Using tilt 2.0.8 Using sass-rails 5.0.7 Using simple_form 4.0.1 Using spring 2.0.2 Using spring-watcher-listen 2.0.1 Using uglifier 4.1.18 Using validate_url 1.0.2 Using web-console 3.7.0 Using webpacker 3.5.5 Bundle complete! 23 Gemfile dependencies, 87 gems now installed. Use bundle info [gemname] to see where a bundled gem is installed.

kritik commented 5 years ago

I think it depends on your application code. Works well in my rails 5.2 applications

drnic commented 3 years ago

I'm getting this exception in app and tests in my rails 6.1/ruby 2.7 app. Will update if I figure out why...

drnic commented 3 years ago

Problem goes away for me with older validates_url helper.

JoeWoodward commented 3 years ago

Just installed and also have this error in console and server. Rails 6.1, no unusual code, no legacy code

using

      validates :attribute, url: { allow_blank: true, no_local: true }

Also seems to interfere with rails loading mechanisms. My enums are complaining that they are already defined after reloading the page