Questions tagged [paperclip]

Paperclip is a library for the Ruby on Rails framework which makes dealing with file attachments easier. In addition to dealing with standalone files, the library provides convenience methods for creating image thumbnails. Paperclip is now deprecated - the authors recommend using ActiveStorage (they have provided a migration guide)

Paperclip is now deprecated. The library authors recommend switching to ActiveStorage. They have provided a migration guide as well.

Paperclip is intended as an easy file attachment library for ActiveRecord. The intent behind it was to keep setup as easy as possible and to treat files as much like other attributes as possible.

For more information:

4288 questions
227
votes
5 answers

Paperclip::Errors::MissingRequiredValidatorError with Rails 4

I'm getting this error when I try to upload using paperclip with my rails blogging app. Not sure what it is referring to when it says "MissingRequiredValidatorError" I thought that by updating post_params and giving it :image it would be fine, as…
nadia
  • 2,489
  • 4
  • 13
  • 12
122
votes
8 answers

Save image from URL by paperclip

Please suggest me a way to save an image from an URL by Paperclip.
khanh
  • 4,228
  • 10
  • 27
  • 47
119
votes
8 answers

How Do I Use Factory Girl To Generate A Paperclip Attachment?

I have model Person that has many Images, where images has a Paperclip attachment field called data, an abbreviated version displayed below: class Person has_many :images ... end class Image has_attached_file :data belongs_to :person …
Laz
  • 3,392
  • 8
  • 30
  • 44
91
votes
4 answers

NameError (uninitialized constant Paperclip::Storage::S3::AWS):

I'm trying to incorporate images into my web app and I keep running into this error after removing quite a few features. It came down to my 'create' application controller and I'm not entirely sure where I should go from here.…
EggSix
  • 988
  • 1
  • 7
  • 11
85
votes
6 answers

Rails Paperclip how to delete attachment?

I am using Paperclip (w/ Amazon s3) on Rails 3. I want to delete an existing attachment without replacing it using an update action. I've only found one example of this here and could not get that to work, it just wouldn't delete and there was…
jyoseph
  • 5,354
  • 9
  • 41
  • 62
75
votes
7 answers

How can I set paperclip's storage mechanism based on the current Rails environment?

I have a rails application that has multiple models with paperclip attachments that are all uploaded to S3. This app also has a large test suite that is run quite often. The downside with this is that a ton of files are uploaded to our S3 account…
John Reilly
  • 1,770
  • 2
  • 16
  • 18
68
votes
3 answers

How to set a file upload programmatically using Paperclip

I have a rake task to seed an application with random data using the faker gem. However, we also have images (like logos) that we want uploaded in this rake task. We already have Paperclip set up, but don't have a way to upload them programmatically…
Jaryl
  • 2,551
  • 1
  • 24
  • 33
63
votes
2 answers

Resize existing images to new style in paperclip & RMagick

I've been using paperclip to upload and auto-resize photos in my Rails app, and I love it. Only problem is about every other month my crazy manager decides he wants a new size to display the photos in. So I add a new style in my Photo model and all…
tybro0103
  • 43,805
  • 32
  • 138
  • 167
59
votes
2 answers

Is it possible to configure Paperclip to produce HTTPS urls for S3?

I'm using Paperclip to manage user-uploaded images on a site that is served entirely under HTTPS. In order to avoid the silly security warnings on IE7/IE8, I need to also serve these images over SSL. I typically render my images using something…
cailinanne
  • 8,162
  • 5
  • 37
  • 47
53
votes
5 answers

Why do I get an "undefined method for `has_attached_file` when installing PaperClip?

I just installed the plugin for Paperclip and I am getting the following error message but I am not sure why: NoMethodError (undefined method `has_attached_file' for #): …
bgadoci
  • 6,083
  • 16
  • 60
  • 89
52
votes
3 answers

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu

I'm working on upgrading a Rails 2.3.11, Ruby 1.9.2 app to Rails 3.0.10, and attachment_fu no longer works. I'm looking at changing to paperclip, carrierwave, or dragonfly for file uploads, or maybe a Rails 3 compatible, maintained version of…
42
votes
14 answers

rails paperclip and passenger `is not recognized by the 'identify' command`

When I upload a photo, my model fails validation, err well even without any validations I'm returned this error: /tmp/stream20100103-13830-ywmerx-0 is not recognized by the 'identify' command. and /tmp/stream20100103-13830-ywmerx-0 is not…
JP Silvashy
  • 42,375
  • 44
  • 141
  • 213
41
votes
11 answers

Paperclip exception : Paperclip::AdapterRegistry::NoHandlerError

Using Paperclip 3.0.1 in rails 3.2.2 I got this error: **Paperclip::AdapterRegistry::NoHandlerError** (No handler found for "2009-11-29-133527.jpg"): In my model I have: class Product < ActiveRecord::Base ... has_many :assets …
Sten Ka Razin
  • 653
  • 1
  • 6
  • 20
39
votes
8 answers

How show hide image in paperclip when no image present

How can I prevent the image tag that calls the associated image from displaying if no image is associated with the record? <%= image_tag @agent.avatar.url %> ...gives me the text "Missing" if there is no image associated with that agent. I want to…
neezer
  • 17,628
  • 29
  • 114
  • 213
39
votes
1 answer

Resize an image with Paperclip

The Paperclip plugin for Rails has a resize option that keeps the image in proportion. According to Ryan Bates' Paperclip Railscast, to make sure that option is on, you have to add a greater-than sign in the end of the size for the style you're…
Yuval Karmi
  • 24,847
  • 38
  • 116
  • 172
1
2 3
99 100