paperclip

Paperclip not saving, no errors

牧云@^-^@ 提交于 2020-01-24 05:46:14
问题 Am stumbled - went through docs, tutorials, etc, and am not sure what I am doing wrong. Another model in the project is set up for Paperclip and is functional when tested. It saves and retrieves attachment file info into the database, and puts file into a subfolder inside public/system. I basically copied the relevant code over toward the model I am working on The model has the following line: has_attached_file :document The table, which model is linked to, has necessary columns: document

Troubles setting up Paperclip + AWS S3 for image storing in our Rails3/Heroku App

断了今生、忘了曾经 提交于 2020-01-23 00:59:05
问题 We have already built a rails app that has several users and an image for each of them. Doing all of the dev work on our localhost, we have working seeds for users & photos...but now that we are trying to use S3 for the image storage, we are running into errors during...always during the "seed" step of the migrations, when doing this: rake db:migrate:reset Apologies for the question, but we have have been banging our heads on this for 11 hours, having gone through every related Stack question

Paperclip::Errors::NotIdentifiedByImageMagickError:

折月煮酒 提交于 2020-01-21 05:19:05
问题 use paperclip upload image error: Command :: identify -format %wx%h '/tmp/103120121106-20384-i7dnzy.png[0]' [paperclip] An error was received while processing: # < Paperclip::Errors::NotIdentifiedByImageMagickError: /tmp/103120121106-20384-i7dnzy.png is not recognized by the 'identify' command.> I find identify: joinall@nxbbs-server:/nxbbs$ type identify identify is hashed (/usr/local/bin/identify) joinall@nxbbs-server:/nxbbs$ convert logo: 2.jpg joinall@nxbbs-server:/nxbbs$ identify 2.jpg 2

AWS S3 bucket policy - how to allow access only from my website?

馋奶兔 提交于 2020-01-21 04:41:10
问题 I have a paperclip text file attachment (in Rails). My bucket policy is: { "Version": "2008-10-17", "Id": "Policy123", "Statement": [ { "Sid": "Stmt123", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": [ "s3:GetObjectVersion", "s3:DeleteObject", "s3:DeleteObjectVersion", "s3:GetObject", "s3:PutObject" ], "Resource": "arn:aws:s3:::my_bucket/*" } ] } I want to restrict access to these actions to only be allowed when the request comes from my website. Is it simply a case of updating

Ruby on Rails - passing a returned value of a method to has_attached_file. Do I get Ruby syntax wrong?

落花浮王杯 提交于 2020-01-17 05:06:30
问题 I'm writing my first RoR app and currently I'm working on allowing users to upload images. I'm using Paperclip for this purpose. One of the steps involves adding has_attached_file to my model: class MyModel < ActiveRecord::Base #... has_attached_file :picture, styles: { large: "120x150#>", small: "60x75#>" } #... end If I do it like this, everything works smoothly (or so it seems). But I will also need to access the same constant values as integers somewhere else, so I've added a hash: class

Conditional Validation with Paperclip difficult

a 夏天 提交于 2020-01-16 08:48:13
问题 I have an "item", which goes through a multi-page creation process. Images are uploaded at step five, and I keep track of the steps by using the attribute "complete". When validating whether an image is attached with paperclip, I get problems using the code below: validates_attachment_presence :pic1, :if => Proc.new { |u| u.complete == "step5"} It seems that I can't access the "complete" attribute, as the active-record object seems to be the paperclip image. Is there a way for me to check at

Either get the id, either the bin, from after_post_process or after_save

点点圈 提交于 2020-01-16 05:07:08
问题 I've been fighting this for some time now, and your help will certainly be of much appreciation. I've built a method to sign pdf documents which you can find here, and now am only one step away from signing my file. I would like to do this asynchronously, but first i would need to understand how to do it synchronously. So I try 2 different approaches, the after post_process : after_post_process do |receipt| if receipt.receipt_file_changed? require 'aws-sdk' logger.debug("RECEIPT ID: #{self

rails 3 paperclip imagemagick problem

僤鯓⒐⒋嵵緔 提交于 2020-01-14 06:19:46
问题 I have been trying to get paperclip working for a few days now with no luck! From what I am aware this error below is related to imagemagick. I have tried to uninstall and install imagemagick both with macports and manually. Also, have Paperclip.options[:command_path] = "/usr/local/bin" set. It's starting to drive me nuts! Photo /var/folders/A7/A7X8PAnOFsCTHkFpeODoO++++TI/-Tmp-/stream,65411,0.jpeg is not recognized by the 'identify' command. I'm running snow leopard. This appears when I run

Paperclip, how to append a random stamp at the end of the file?

限于喜欢 提交于 2020-01-14 04:35:08
问题 I'm using paperclip with my rails 3 app. I want to append a random string, nothing to long or crazy at the end of the file to cache bust the CDN. Anyone know a real simple way to do this? Here is what I have currently: has_attached_file :photo, :styles => { :thumb => "70x70>" }, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:rails_env/public/users/:id/:style/:basename.:extension", ..... I would like a file name like FILENAME_31313.png Where 31313 is random

Ruby on Rails error: “Undefined method `call' for ”result == false“:String” error in create method

雨燕双飞 提交于 2020-01-13 05:15:48
问题 When I try to create a listing in my app with an image this error is thrown: undefined method `call' for "result == false":String. The error occurred after I installed devise gem. But devise shouldn't have anything to do with creating a new listing? The other parts of the app works fine, and I can create new listings without images. Error message NoMethodError in ArtistsController#create undefined method `call' for "result == false":String The method it points to is a callback method in