diff --git a/lib/generators/simple_form/templates/simple_form.rb b/lib/generators/simple_form/templates/simple_form.rb index 30fd82e7..e3006427 100644 --- a/lib/generators/simple_form/templates/simple_form.rb +++ b/lib/generators/simple_form/templates/simple_form.rb @@ -10,6 +10,9 @@ SimpleForm.setup do |config| # CSS class to add to all hint tags. # config.hint_class = :hint + # Default tag used on errors. + # config.error_class = :error + # Default tag used on errors. # config.error_tag = :span diff --git a/lib/simple_form.rb b/lib/simple_form.rb index 476cc376..7534dd40 100644 --- a/lib/simple_form.rb +++ b/lib/simple_form.rb @@ -23,6 +23,10 @@ module SimpleForm mattr_accessor :error_tag @@error_tag = :span + # CSS class to add to all error tags. + mattr_accessor :error_class + @@error_class = :error + # Method used to tidy up errors. mattr_accessor :error_method @@error_method = :first diff --git a/lib/simple_form/components/errors.rb b/lib/simple_form/components/errors.rb index 33c82177..81ed15a3 100644 --- a/lib/simple_form/components/errors.rb +++ b/lib/simple_form/components/errors.rb @@ -20,7 +20,7 @@ module SimpleForm end def error_html_options - html_options_for(:error, [:error]) + html_options_for(:error, [SimpleForm.error_class]) end protected