Sha256: 6e1820ea1ce2f731a7f022991bd085d113789fbab8b375c71172db609b58ce6f

Contents?: true

Size: 804 Bytes

Versions: 1

Compression:

Stored size: 804 Bytes

Contents

module DryCrud
  # Dry Crud Rails engine
  class Engine < Rails::Engine
    initializer 'dry_crud.field_error_proc' do |_app|
      # Fields with errors are directly styled in DryCrud::FormBuilder.
      # Rails should just output the plain html tag.
      ActionView::Base.field_error_proc =
        proc { |html_tag, _instance| html_tag }

      # Load dry_crud engine helpers first so that the application may override
      # them.
      paths = ApplicationController.helpers_path
      helper_path = "#{File::SEPARATOR}app#{File::SEPARATOR}helpers"
      regexp = /dry_crud(-\d+\.\d+\.\d+)?#{helper_path}\z/
      dry_crud_helpers = paths.detect { |p| p =~ regexp }
      if dry_crud_helpers
        paths.delete(dry_crud_helpers)
        paths.prepend(dry_crud_helpers)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dry_crud-5.2.0 lib/dry_crud/engine.rb