How to update a clip binding field record

I created an editing form for a profile page that contains a first name, last name and photo

<%= form_tag "/profiles/update", :html => {:multipart => true} do%>

    <h4>First Name:</h4>
    <%= text_field_tag :first_name, @profile.first_name %>

    <h4>Last Name:</h4>
    <%= text_field_tag :last_name, @profile.last_name %>

    <h4>Photo</h4>
    <%= file_field_tag :photo %>

    <%= submit_tag "Save changes" %>

<% end %>

and when updating I put

@profile.update_attributes(:first_name => params[:first_name], :last_name => params[:last_name], :photo => params[:photo])

So, when I run the edit form and select a new image for the file field, then send me this error

Paperclip::AdapterRegistry::NoHandlerError in ProfilesController#update
No handler found for "Pic.jpg"

Any suggestions what the problem is here?

+3
source share
1 answer

It should be:

<%= form_tag "/products/create", :multipart => true do%>

Now it will work fine

+4
source

All Articles