Paperclip not working on update action (rails 2.1)

Paperclip is nice but its not working on the update action.

Well, to be exact, I can attach new picture records via a scaffolded
controller and edit them, but the edit controller loses them when the
record is updated?

Is this a known issue?

Remember to attach :html => { :multipart => true } to your form_for
declaration for both the new.html.erb and edit.html/erb

I am having the exact same issue as well.

At first I thought it was something with my Amazon S3 setup, so I
removed all the S3 stuff and tried it with the file system settings
and I’m having the same result. No errors are thrown by paperclip but
its just not working.

The file does appear to be getting submitted via the form:


but nothing happens afterwards and I cant access it via
model.avatar.url, etc…

btw, I’m on Rails 2.1.1

I have

form_for (@user, :html => {:multipart => true}) do |f|

and paperclip not working.

I noticed:

Parameters: {“user”=>{“profile_pic”=>#<File:/tmp/CGI.1316.5>

It seems to be uploading to /tmp, but it doesn’t get copied over to
RAILS_ROOT/public/profile_pic like I’m expecting it to.

Does anybody know what might be wrong?

BTW, I’m using Rails 2.1.0 with paperclip from the github repository.

David :slight_smile:

I figured it out.

Stupid, but I forgot to add :avatar to the list of attributes. So it
was protected from mass_assignment.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs