From d4ba179fe0be6b296f5477eedd20ffa502de37a2 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sun, 26 Apr 2020 15:22:54 +0200 Subject: [PATCH] Do not explicitly require jquery-rails Since CSV can also be loaded via Webpacker, jquery-rails dependency should be an optional dependency. --- CHANGELOG.md | 1 + README.md | 21 +++++++++++++++++++-- client_side_validations.gemspec | 1 - 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa8f4d773..f013dfbed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## master / unreleased * [FEATURE] Drop Ruby 2.3 support +* [FEATURE] Do not require `jquery-rails` gem ([#785](https://github.com/DavyJonesLocker/client_side_validations/pull/785)) * [FEATURE] Add support for many association validations ([#783](https://github.com/DavyJonesLocker/client_side_validations/pull/783)) ## 16.2.0 / 2020-04-10 diff --git a/README.md b/README.md index 50d0e2f35..e807b1241 100644 --- a/README.md +++ b/README.md @@ -92,9 +92,26 @@ attach its event handlers. #### When using Sprockets #### -Make sure that you are requiring jQuery. +Since ClientSideValidations can also be used via webpacker, it does not require +by default `jquery-rails` gem. + +Make sure that `jquery-rails` is part of your bundled gems and `application.js`, +otherwise add: + +```ruby +gem 'jquery-rails', '~> 4.3' +``` + +to your `Gemfile`, run `bundle`, and add + +```js +//= require jquery +``` + +to your `app/assets/javascripts/application.js` file. -Add the following to your `app/assets/javascripts/application.js` file. +Then, add the following to your `app/assets/javascripts/application.js` file +after `//= require jquery`. ```js //= require rails.validations diff --git a/client_side_validations.gemspec b/client_side_validations.gemspec index 29d94ddb3..00cbd9f0f 100644 --- a/client_side_validations.gemspec +++ b/client_side_validations.gemspec @@ -27,7 +27,6 @@ Gem::Specification.new do |spec| spec.add_dependency 'rails', '>= 5.0.0.1', '< 6.1' - spec.add_dependency 'jquery-rails', '~> 4.3' spec.add_dependency 'js_regex', '~> 3.1' spec.add_development_dependency 'appraisal', '~> 2.2'