paperclip

Ajax, Multiple Attachments and Paperclip question.

Alright everyone this is a bit of a complicated setup so if I need to clarify the question just let me know. I have a model: class IconSet < ActiveRecord::Base has_many :icon_graphics end This Model has many icongraphics: class IconGraphic < ActiveRecord::Base belongs_to :icon_set has_attached_file :icon has_attached_file :f...

rails + paperclip: Is a generic "Attachment" model a good idea?

On my application I've several things with attachments on them, using paperclip. Clients have one logo. Stores can have one or more pictures. These pictures, in addition, can have other information such as the date in which they were taken. Products can have one or more pictures of them, categorized (from the font, from the back, etc)....

How to copy a file using Paperclip

Does anyone know of a way to copy files with Paperclip using S3 for storage? Before I try to write my own, I just wanted to make sure there wasn't already a way to do this. Thanks ...

Paperclip plugin on Rails 3

Hi all, I tried to use paperclip plugin on rails 3-beta 3. I installed this plugin successfully, but when I use the following script to generate: rails generate paperclip xxx xxx it said generator not found. Any ideas? Thanks. ...

NoMethodError: undefined method `has_attached_file'

Paperclip produces this error, after checking out the plugin's rails3 branch. My Gemfile has following line: gem 'paperclip', :git => 'http://github.com/thoughtbot/paperclip.git', :branch => 'rails3' And the error message is: NoMethodError: undefined method `has_attached_file' for #<Class:0x2a50530> ...

How to upload file via the JSON interface in Rails

Hi, I have a web service in Rails which among all else should provide file upload functionality to the clients. The clients all use JSON to talk to the webservice. I use the Paperclip plugin for upload management. The problem is I do not know how to upload a file via JSON. All works in the web formular, but I cannot find information on...

Rails - Paperclip, getting width and height of image in model

Trying to get the width and height of the uploaded image while still in the model on the initial save. Any way to do this? Here's the snippet of code I've been testing with from my model. Of course it fails on "instance.photo_width". has_attached_file :photo, :styles => { :original => "634x...

Paperclip - Validate File Type but not Presence

I am using paperclip to handle my file uploads, and in one situation I don't want the file to be mandatory. I do however want to make sure it is a specific file type when it is present. I have this: class TestModel < ActiveRecord::Base #stuff has_attached_file :sound #etc... validates_attachment_content_type :sound, :conten...

Large file download for a Rails project

One client project will be online two months later. One of the requirements changed is to support large files (10 to 15MB per RAW camera file, expected 1000 to 5000 files download per day) download worldwide for their customers. The process will be: there is upload screen via paperclip to the rails local public folder a hourly task to ...

Paperclip failing to upload on specific scaffold, yet works on others

I know there are tons of questions about paperclip, but I failed to find the answer to my problem. I know its prob just something simple, but I I'm running out of hair to pull out. I have paperclip working on other parts of my project, they work with no problem, however, a certain scaffold fails to upload, all the attributes to the upl...

Paperclip Progres bar

I havve been looking around for something that shows the progress of an upload using Paperclip. I can't find any solutions is there any out there? If not is there any particular progress uploader that can be recommended? ...

Installing paperclip plugin

I'm trying to install the paperclip plugin with the following command: ruby script/plugin install git://github.com/thoughtbot/paperclip.git But I'm getting some errors: ruby script/plugin install git://github.com/thoughtbot/paperclip.git --force svn: '/home/app/vendor/plugins' is not a working copy /usr/lib/ruby/1.8/open-uri.rb:32:in...

Change paperclip tmp files location

Hello, Is it possible to move the (/tmp/stream*) tempfiles generated by paperclip to another location like /railsapp/public/tmp without changing tmpfiles for the whole app enviroment? I would like to show a preview of the uploaded file if valdation fails on the model. Best regards. Asbjørn Morell ...

How do I calculate the content-length of a file upload in ruby?

I need to include the content-length of a image /png file posted in an upload to a webservice. But how do I calculate the content-length to include in the header? Thanks. I am submitting it using rest-client. The webservice for the upload is Postful: and the documentation has been unclear: http://www.postful.com/developer/guide#upl...

Rails Beta3 & PaperClip & Passenger Bundler::PathError

So I'm going around in circles with this - I'm using a fork of the Paperclip Rails gem to get it to work with Rails3. Works fine on my OSX box with Passenger. But on my server (CentOS 5) I get this this error: git://github.com/lmumar/paperclip.git (at rails3) is not checked out. Please runbundle install(Bundler::PathError)Blockquote I...

How do I use File.new to find a file from Rails?

I am trying to read a file that has been saved on the /system folder using Paperclip, for example. But when I use that .url method from Paperclip to read that file using File.new, I get that the file isn't found. The directory is correct, but I still can't access it. What is the right way to find a file for File.new for example? I tr...

How to get paperclip to delete files

I have a model that is using Paperclip to manage the file. After I delete the model, I obviously would like the file to be deleted as well, but I cannot seem to find out how to get the file deleted using Paperclip. I have tried self.sourcefile = nil if !sourcefile.dirty? in the before_destroy def, but that had no effect. (I want to ...

Displaying pic for user through a question's answer

Ok, I am trying to display the profile pic of a user. The application I have set up allows users to create questions and answers (I am calling answers 'sites' in the code) the view in which I am trying to do so is in the /views/questions/show.html.erb file. It might also be of note that I am using the Paperclip gem. Here is the set up: ...

paperclip error

i am trying paperclip for the first time and followed this tutorial all is well until i use styles. this is the code has_attached_file :photo, :url => "/uploads/products/:id/:style/:basename.:extension", :path => ":rails_root/public/uploads/products/:id/:style/:basename.:extension", :styles => { :thumb=> "100x100#" } the error i se...

Styles in Paperclip only if it's an image [rails]

I'm using paperclip to upload all sorts of files (text documents, binaries, images). I'd like to put this in my model: has_attached_file :attachment, :styles => { :medium => "300x300>", :thumb => "100x100>" } but it has to perform the styles only if it's an image. I tried adding if :attachment_content_type =~ /^image/ but it didn...