When using nested_form_for and having a file_field in fields_for I get the following error from paperclip:
Paperclip::AdapterRegistry::NoHandlerError in ProjectsController#create
No handler found for "scan.pdf"
This is correct, because the params don’t show an #<ActionDispatch::Http::UploadedFile> object, but just the file name.
Before using nested_form_for it worked, it works when I uncomment the file_field and it also works when I build the first object for fields_for but this shouldn’t be necessary..
My setup is as follows:
- ruby 1.9.3
- rails (3.2.8)
- paperclip (3.3.0)
- nested_form (0.3.0)
The code:
# @project.schemes.build
= nested_form_for @project do |f|
= f.fields_for :schemes do |ff|
= ff.text_field :name
= ff.file_field :scan
The generated form is not multipart and you have 2 options to solve this issue:
specify multipart manually
try using nested_form gem from the master branch which have this issue solved but not yet released