I have all the default settings from paperclip’s website. When I create a new application and put the settings in, once I save my model, the ‘photo’ paperclip attribute gets saves nicely, all is fine (here is the SQL INSERT sample):
"photo"=>#<ActionDispatch::Http::UploadedFile:0x007f990a3d92d0
@original_filename="Screen Shot 2011-10-21 at 6.02.56 AM.png",
@content_type="image/png", @headers="Content-Disposition: form-data;
name=\"event[photo]\"; filename=\"Screen Shot 2011-10-21 at 6.02.56
AM.png\"\r\nContent-Type: image/png\r\n"
and I get:
[paperclip] Saving attachments
Now in my app other app where I use Devise and Cancan, I have the exact same Paperclip setting, I do get the
[paperclip] Saving attachments.
But, It does not save the ‘photo’ and don’t see the photo attributes getting defined at all.
Now I’ve seen a similar post that gets solved adding
attr_accessible photo
to the model, and I did that, and still it’s not working.
I’ve been wasting so many hours on this, sometimes I feel like I should have just created my own image upload…
Any idea? Thx!
and by the way. Same issue on a simple scaffold object where I add
attr_accessible :photo
If you’re using a framework like jQuery Mobile or some sort of AJAX/PJAX mechanism, your uploads will be lost as POST in Ajax, since JS cannot read your local files…
You’ll have to use some uploadify-like plugin or submit your form the “regular” way.
Edit:
To make things clear, the easiest way will be to add data-ajax=”false” as a form attribute. In Rails 3, using the form helper, you’d write something along those lines: