From 9d23632c6775f701e8517b091de4e6a6a08a188a Mon Sep 17 00:00:00 2001 From: Larry Reid Date: Sun, 26 Oct 2025 17:11:21 -0700 Subject: [PATCH] Check existence of rich_text_area --- demo/config/initializers/filter_parameter_logging.rb | 4 ++-- lib/bootstrap_form/form_builder.rb | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/demo/config/initializers/filter_parameter_logging.rb b/demo/config/initializers/filter_parameter_logging.rb index c0b717f7..f72dcdfa 100644 --- a/demo/config/initializers/filter_parameter_logging.rb +++ b/demo/config/initializers/filter_parameter_logging.rb @@ -3,6 +3,6 @@ # Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. # Use this to limit dissemination of sensitive information. # See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. -Rails.application.config.filter_parameters += [ - :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc +Rails.application.config.filter_parameters += %i[ + passw email secret token _key crypt salt certificate otp ssn cvv cvc ] diff --git a/lib/bootstrap_form/form_builder.rb b/lib/bootstrap_form/form_builder.rb index ef7dccc4..e866c855 100644 --- a/lib/bootstrap_form/form_builder.rb +++ b/lib/bootstrap_form/form_builder.rb @@ -1,10 +1,16 @@ # require 'bootstrap_form/aliasing' module BootstrapForm - class FormBuilder < ActionView::Helpers::FormBuilder + class FormBuilder < ActionView::Helpers::FormBuilder # rubocop:disable Metrics/ClassLength attr_reader :layout, :label_col, :control_col, :has_error, :inline_errors, :label_errors, :acts_like_form_tag + class << self + def redefine_rich_text_area? + ActionView::Helpers::FormBuilder.instance_methods.any? { _1 == :rich_text_area } + end + end + include BootstrapForm::Helpers::Field include BootstrapForm::Helpers::Bootstrap @@ -32,7 +38,7 @@ class FormBuilder < ActionView::Helpers::FormBuilder include BootstrapForm::Inputs::PhoneField include BootstrapForm::Inputs::RadioButton include BootstrapForm::Inputs::RangeField - include BootstrapForm::Inputs::RichTextArea if Gem.loaded_specs["actiontext"] + include BootstrapForm::Inputs::RichTextArea if redefine_rich_text_area? include BootstrapForm::Inputs::SearchField include BootstrapForm::Inputs::Select include BootstrapForm::Inputs::Submit