diff --git a/CHANGELOG.md b/CHANGELOG.md index 0271a6f7a..a48330ab9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,10 @@ https://github.com/bootstrap-ruby/bootstrap_form/releases ## Diffs +- [5.3.1](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.3.0...v5.3.1) + [Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-09-15T15%3A00..2023-09-15T16%3A00) - [5.3.0](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.2.3...v5.3.0) - [Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-06-18T07%3A00..2023-09-15T16%3A00) + [Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-06-18T07%3A00..2023-09-15T15%3A00) - [5.2.2](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.2.2...v5.2.3) [Closed issues](https://github.com/bootstrap-ruby/bootstrap_form/issues?q=closed%3A2023-05-28T16%3A00..2023-06-18T07%3A00) - [5.2.2](https://github.com/bootstrap-ruby/bootstrap_form/compare/v5.2.1...v5.2.2) diff --git a/demo/Gemfile.lock b/demo/Gemfile.lock index 99aa41016..b9cd79fd6 100644 --- a/demo/Gemfile.lock +++ b/demo/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - bootstrap_form (5.3.0) + bootstrap_form (5.3.1) actionpack (>= 6.1) activemodel (>= 6.1) diff --git a/demo/app/models/user.rb b/demo/app/models/user.rb index 157b1a07e..67a627e1f 100644 --- a/demo/app/models/user.rb +++ b/demo/app/models/user.rb @@ -3,7 +3,7 @@ class User < ApplicationRecord serialize :preferences, coder: JSON - validates :email, presence: true, length: { minimum: 5 } + validates :email, presence: true, length: { minimum: 5 }, if: :always validates :terms, acceptance: { accept: true } # Conditional (always disabled) validators used in tests @@ -15,6 +15,10 @@ class User < ApplicationRecord has_rich_text(:life_story) if Rails::VERSION::STRING > "6" + def always + true + end + def age 42 end diff --git a/lib/bootstrap_form/components/validation.rb b/lib/bootstrap_form/components/validation.rb index 9c2d1b293..24f42c14c 100644 --- a/lib/bootstrap_form/components/validation.rb +++ b/lib/bootstrap_form/components/validation.rb @@ -47,6 +47,9 @@ def presence_validators?(target, object, attribute) end def call_with_self(object, proc) + if proc.is_a? Symbol + proc = object.method(proc) + end object.instance_exec(*[(object if proc.arity >= 1)].compact, &proc) end diff --git a/lib/bootstrap_form/version.rb b/lib/bootstrap_form/version.rb index bb89fcde7..dd57f2f89 100644 --- a/lib/bootstrap_form/version.rb +++ b/lib/bootstrap_form/version.rb @@ -1,4 +1,4 @@ module BootstrapForm - VERSION = "5.3.0".freeze + VERSION = "5.3.1".freeze REQUIRED_RAILS_VERSION = ">= 6.1".freeze end