diff --git a/.rubocop.yml b/.rubocop.yml index b0708359..f9e797b9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -45,6 +45,7 @@ Metrics/AbcSize: Metrics/BlockLength: Exclude: + - "lib/bootstrap_form/inputs/base.rb" - "demo/config/**/*" - "demo/test/**/*" - "test/**/*" diff --git a/lib/bootstrap_form/inputs/base.rb b/lib/bootstrap_form/inputs/base.rb index 65d9a17d..adf85a78 100644 --- a/lib/bootstrap_form/inputs/base.rb +++ b/lib/bootstrap_form/inputs/base.rb @@ -31,9 +31,16 @@ def bootstrap_select_group(field_name) bootstrap_alias field_name end + # Creates the methods *_without_bootstrap and *_with_bootstrap. + # + # If your application did not include the rails gem for one of the dsl + # methods, then a name error is raised and suppressed. This can happen + # if your application does not include the actiontext dependency due to + # `rich_text_area` not being defined. def bootstrap_alias(field_name) alias_method "#{field_name}_without_bootstrap".to_sym, field_name alias_method field_name, "#{field_name}_with_bootstrap".to_sym + rescue NameError # rubocop:disable Lint/SuppressedException end end