This gem allows you to quickly integrate FilePond with your Ruby on Rails app.
- Rails 7.0.x and above
- Use of importmap-rails
Add this line to your application's Gemfile:
And then run:
Add the following to your
*= require 'filepond'
head section of your layout:
Rails.application.routes.draw do mount Filepond::Rails::Engine, at: '/filepond' end
Note: You must mount the routes at
This gem compromises of two parts:
- An ingress controller for the FilePond
At the present moment, the above parts are designed (and assumed) to work together.
The gem assumes that you set up your models and Active Storage configuration in a standard Rails way. Assuming you have a form that looks like this:
<%= form_with model: @user, url: update_avatar_path, method: :post do |f| %> <%= f.label :avatar, 'Update your avatar' %> <%= f.file_field :avatar, class: 'filepond', direct_upload: true %> <%= f.button 'Update' %> <% end %>
You can instantiate the
file_field component like so:
FilePond(which corresponds to the original FilePond library)
FilePondRails(which is a convenience helper that integrates and sets up FilePond to work with our
filepond-rails is configured with Docker to help developer-contributors be able to easily work on this gem locally.
To get started:
- Fork this repository
- git clone it to your local machine and cd into it
docker compose build
To run the gem through the "dummy" app, run:
docker compose up
To enter the development environment where you can run
bin/rails g controller and other commands:
docker compose run app bash
You should now be able to run tests locally within this bash container:
bin/rails test && bin/rails app:test:system
The gem is available as open source under the terms of the MIT License.