I'm using Paperclip in a gem I built for a specific use case. My gem creates an interface for non-programmers to create and edit forms and then allows users to answer those forms.
I want to use Paperclip in order to provide a "File Upload" input type for questions, so my forms are more versatile. However, this means that I need to use the file_field_tag
method to display the file input and I need to manually save whatever information is submitted through that input into the appropriate model object. Currently I'm sending the information through with the name question_1
and then trying to pull the uploaded data out with params["question_1"]
.
My code looks like this:
answer.update_attributes(upload: params["question_1"])
But I'm getting a No handler found for <image_name>
error and I can't figure out what I'm doing wrong. I thought Paperclip handles everything after I pass it the data from a file_field
?
Solution:
My form looked like this: <%= form_for @answer_set, multipart: true do %>
when it should have looked like this: <%= form_for @answer_set, html: { multipart: true } do %>
.