diff --git a/Gemfile b/Gemfile index d52ea57..00ffdfe 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.7.1' gem 'jquery-rails', '~> 4.3' -gem 'client_side_validations', '~> 16.2.0' +gem 'client_side_validations', github: 'MichalRemis/client_side_validations', branch: 'SupportDateTimeSelects' # '~> 16.2.0' gem 'client_side_validations-simple_form', '~> 10.1.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' diff --git a/Gemfile.lock b/Gemfile.lock index a36df80..ad9b420 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: https://github.com/MichalRemis/client_side_validations.git + revision: 5fa9a94829831b8714a5458431f54d992f597d9b + branch: SupportDateTimeSelects + specs: + client_side_validations (16.2.0) + js_regex (~> 3.1) + rails (>= 5.0.0.1, < 6.1) + GEM remote: https://rubygems.org/ specs: @@ -62,10 +71,6 @@ GEM builder (3.2.4) byebug (11.1.3) character_set (1.4.0) - client_side_validations (16.2.0) - jquery-rails (~> 4.3) - js_regex (~> 3.1) - rails (>= 5.0.0.1, < 6.1) client_side_validations-simple_form (10.1.0) client_side_validations (>= 15.0, < 17.0) simple_form (~> 5.0) @@ -200,7 +205,7 @@ PLATFORMS DEPENDENCIES bootsnap (>= 1.4.2) byebug - client_side_validations (~> 16.2.0) + client_side_validations! client_side_validations-simple_form (~> 10.1.0) jbuilder (~> 2.7) jquery-rails (~> 4.3) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index aff49c7..62b4c75 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -1,2 +1,3 @@ //= require jquery //= require rails.validations +//= require rails.validations.simple_form diff --git a/app/models/box.rb b/app/models/box.rb index 533e22a..f4af813 100644 --- a/app/models/box.rb +++ b/app/models/box.rb @@ -1,2 +1,7 @@ class Box < ApplicationRecord + validates :name, presence: true + validates :description, presence: true + validates :a_date, presence: true + validates :a_datetime, presence: true + validates :a_time, presence: true end diff --git a/app/views/boxes/_form.html.erb b/app/views/boxes/_form.html.erb index cb05898..06c75a6 100644 --- a/app/views/boxes/_form.html.erb +++ b/app/views/boxes/_form.html.erb @@ -1,4 +1,5 @@ -<%= form_with(model: box, local: true) do |form| %> +