Refile Input
Refile Input gem adds custom input type to formtastic to use refile file uploader. Well, name is self-explanatory and gem is super-simple. It's built upon refile's input helper.
Installation
Add the gem:
gem "refile-input", require: ["inputs/refile_input"]Use the gem:
form do |f|
f.input :image, as: :refile
endAvailable options
Gem brings support of the following options:
-
directdetermines whether file should be uploaded asynchronously or not. Uploading host might be changed withhostoption. More about it read in refile documentation. Note that refile's js should be included on the page. -
image_previewis an option to generate image preview. As arguments it accepts list of refileattachment_urloptions. Read more here. - all formtastic's options such as
hint,label, etc.