diff --git a/lib/action_form.rb b/lib/action_form.rb index f4778cd..ea95c96 100644 --- a/lib/action_form.rb +++ b/lib/action_form.rb @@ -11,6 +11,10 @@ module ActionForm require_relative 'action_form/engine' + def self.external_validation_methods + @external_validation_methods ||= [] + end + def self.rails_buggy? Rails.gem_version >= Gem::Version.new('7.0.3') end diff --git a/lib/action_form/form.rb b/lib/action_form/form.rb index 5444d70..bda3ccc 100644 --- a/lib/action_form/form.rb +++ b/lib/action_form/form.rb @@ -128,7 +128,7 @@ def method_missing(method_sym, *arguments, &block) # rubocop:disable Style/Missi return if method_sym == :id= # call validates/validate class methods - if method_sym =~ /^validates?$/ || method_sym == :phony_normalize || method_sym == :libphone_normalize + if method_sym =~ /^validates?$/ || ActionForm.external_validation_methods.include?(method_sym) class_eval do public_send(method_sym, *arguments, &block) end