SimpleForm::ActionViewExtensions::FormHelper
with_simple_form_field_error_proc
default_field_error_proc = ::ActionView::Base.field_error_proc
begin
::ActionView::Base.field_error_proc = SimpleForm.field_error_proc
yield
ensure
::ActionView::Base.field_error_proc = default_field_error_proc
end
When the yield method is commented out, it will not be rendered.
simple_form_for
...
...
with_simple_form_field_error_proc do
form_for(record, options, &block)
end
When the form_for method is commented out, not be rendered.
simple_form_for is the form_for wrapper of ActionView::Helpers:: FormHelper.
definition of form_for
# Example:
#
# simple_form_for @user do |f|
# f.input :name, hint: 'My hint'
# end
The class of f, that is block variable ( not block argument, Proc argument) , is SimpleForm::FormBuilder.
@user class in Example is the same as f.object.
SimpleForm::FormBuilder
pry ls
ActiveSupport::ToJsonWithActiveSupportEncoder#methods: to_json
ActionView::ModelNaming#methods: convert_to_model model_name_from_record_or_class
SimpleForm::ActionViewExtensions::Builder#methods: simple_fields_for
ActionView::Helpers::FormBuilder#methods:
check_box emitted_hidden_id? month_field phone_field time_select
collection_select field_helpers multipart radio_button time_zone_select
color_field field_helpers= multipart= range_field to_model
country_select field_helpers? multipart? search_field to_partial_path
date_field fields number_field select url_field
date_select fields_for object= submit week_field
datetime_field file_field object_name= telephone_field
datetime_local_field grouped_collection_select options text_area
datetime_select hidden_field options= text_field
email_field index password_field time_field
SimpleForm::FormBuilder#methods:
association collection_check_boxes full_error label mappings= template
attribute collection_radio_buttons hint lookup_action mappings? wrapper
button error input lookup_model_names object
button_button error_notification input_field mappings object_name
self.methods: __pry__
instance variables:
@default_options @index @nested_child_index @object_name @template
@defaults @multipart @object @options @wrapper
locals: _ __ _dir_ _ex_ _file_ _in_ _out_ _pry_
hint
f.hint('My hint')
-> "<p class=\"help-block\">My hint</p>"