Module: EacRailsUtils::CommonFormHelper

Defined in:
app/helpers/eac_rails_utils/common_form_helper.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/date_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/fields_for.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/file_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/time_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/select_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/currency_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/year_month_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/common_text_fields.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/radio_select_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/association_select_field.rb,
app/helpers/eac_rails_utils/common_form_helper/form_builder/searchable_association_field.rb

Defined Under Namespace

Classes: FormBuilder

Instance Method Summary collapse

Instance Method Details

#common_form(model_instance, options = {}, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/eac_rails_utils/common_form_helper.rb', line 13

def common_form(model_instance, options = {}, &block)
  submit_label = options.delete(:submit_label)
  options[:html] ||= {}
  options[:html][:class] = 'CommonFormHelper'
  form_for(model_instance, options) do |form|
    fb = FormBuilder.new(form, self)
    errors(model_instance) <<
      capture(fb, &block) <<
      errors_not_showed(model_instance, fb.field_errors_showed) <<
      form.submit(submit_label, class: 'btn btn-primary')
  end
end