christianblais / triggerify

When X, if Y, do Z - Powerful event pipeline for your Shopify store
32 stars 8 forks source link

Remove Rails' custom html around errors #111

Closed christianblais closed 2 years ago

christianblais commented 2 years ago

@tjoyal this should fix it, I forgot to include it in the previous PR. Unfortunately, this is at the app level, and not per form builder (which sucks). But hey, it works?

Other option would be to do something like;

module CustomFormFor
  def custom_form_for(*args, &block)
    original_field_error_proc = ::ActionView::Base.field_error_proc
    ::ActionView::Base.field_error_proc = -> (html_tag, instance) { html_tag }
    form_for(*args, &block)
  ensure
    ::ActionView::Base.field_error_proc = original_field_error_proc
  end
end

ActiveSupport.on_load(:action_view) do
  include CustomFormFor
end

But hey... the simpler the better?