Module: ActiveStorage::FileFieldWithDirectUploadHelper
- Defined in:
- app/helpers/active_storage/file_field_with_direct_upload_helper.rb
Overview
Temporary hack to overwrite the default file_field_tag and Form#file_field to accept a direct_upload: true option that then gets replaced with a data-direct-upload-url attribute with the route prefilled.
Instance Method Summary collapse
- #file_field(object_name, method, options = {}) ⇒ Object
- #file_field_tag(name, options = {}) ⇒ Object
Instance Method Details
#file_field(object_name, method, options = {}) ⇒ Object
9 10 11 |
# File 'app/helpers/active_storage/file_field_with_direct_upload_helper.rb', line 9 def file_field(object_name, method, = {}) ActionView::Helpers::Tags::FileField.new(object_name, method, self, convert_direct_upload_option_to_url()).render end |
#file_field_tag(name, options = {}) ⇒ Object
5 6 7 |
# File 'app/helpers/active_storage/file_field_with_direct_upload_helper.rb', line 5 def file_field_tag(name, = {}) text_field_tag(name, nil, convert_direct_upload_option_to_url(.merge(type: :file))) end |