Skip to content

Commit 29aeedf

Browse files
authored
Merge pull request #768 from lcreid/another-dont-define-rich-textarea
Still trying to handle rich_textarea
2 parents a483825 + 9d23632 commit 29aeedf

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

demo/config/initializers/filter_parameter_logging.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
44
# Use this to limit dissemination of sensitive information.
55
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6-
Rails.application.config.filter_parameters += [
7-
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
6+
Rails.application.config.filter_parameters += %i[
7+
passw email secret token _key crypt salt certificate otp ssn cvv cvc
88
]

lib/bootstrap_form/form_builder.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# require 'bootstrap_form/aliasing'
22

33
module BootstrapForm
4-
class FormBuilder < ActionView::Helpers::FormBuilder
4+
class FormBuilder < ActionView::Helpers::FormBuilder # rubocop:disable Metrics/ClassLength
55
attr_reader :layout, :label_col, :control_col, :has_error, :inline_errors,
66
:label_errors, :acts_like_form_tag
77

8+
class << self
9+
def redefine_rich_text_area?
10+
ActionView::Helpers::FormBuilder.instance_methods.any? { _1 == :rich_text_area }
11+
end
12+
end
13+
814
include BootstrapForm::Helpers::Field
915
include BootstrapForm::Helpers::Bootstrap
1016

@@ -32,7 +38,7 @@ class FormBuilder < ActionView::Helpers::FormBuilder
3238
include BootstrapForm::Inputs::PhoneField
3339
include BootstrapForm::Inputs::RadioButton
3440
include BootstrapForm::Inputs::RangeField
35-
include BootstrapForm::Inputs::RichTextArea if Gem.loaded_specs["actiontext"]
41+
include BootstrapForm::Inputs::RichTextArea if redefine_rich_text_area?
3642
include BootstrapForm::Inputs::SearchField
3743
include BootstrapForm::Inputs::Select
3844
include BootstrapForm::Inputs::Submit

0 commit comments

Comments
 (0)