paperclip

`fetch': key not found: “S3_BUCKET_NAME” (KeyError) with paperclip/aws s3/rails

六月ゝ 毕业季﹏ 提交于 2019-12-04 15:40:22
I am getting a 'fetch': key not found: "S3_BUCKET_NAME" (KeyError) error in rails (4.2.3) using 'aws-sdk', '~> 2.3' and "paperclip", "~> 5.0.0" I have set the Keys in my environment via terminal and running heroku config shows them listed. In both my config/environments/development.rb as well as in my config production.rb I have included: config.paperclip_defaults = { storage: :s3, s3_credentials: { bucket: ENV.fetch('S3_BUCKET_NAME'), access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'), secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'), s3_region: ENV.fetch('AWS_REGION'), } } I have also

Serving images from public folder when using asset pipeline Rails 3.2

混江龙づ霸主 提交于 2019-12-04 14:42:19
I am using Rails 3.2 asset pipeline to serve my assets(images, javascript. css). I have added paperclip for photo uploads. paperclip by default stores files in public/system When I use the url generated by paperclip which is something like /system/users/avatar/000/000/thumb/whatever.jpg It gives me no route error. the file is there at the above location but I think it may be issue with asset pipleline. Any ideas what might be going wrong ? just like user451893 said. you should configure your web-server (nginx, apache etc) to deliver all static assets! in case you don't, then you need to turn

Paperclip w/ Imagemagick, Amazon S3 and Heroku - Imagemagick & S3 work, but the Paperclip fields don't get set in database. Works fine in dev

时光毁灭记忆、已成空白 提交于 2019-12-04 14:14:40
I'm using Paperclip with Imagemagick in my app, using Amazon S3 for storage. Everything works fine in development. But in production on Heroku it's not working correctly. The image gets uploaded to Amazon S3, and the thumbnail creation works, so that part of the Paperclip, Imagemagick and S3 combo is working ok. But for some reason, the Paperclip specific model fields are not getting filled: imagestore_file_name: imagestore_content_type: imagestore_file_size: imagestore_updated_at: In development, these all get filled in, but not in production on Heroku. When I try to display an image in

rails paperclip no direct access through sql query from another model

喜你入骨 提交于 2019-12-04 13:48:33
if tried to access paperclip images from another model to show in its view through a sql query, it wont show the images. i tried something like this from a category controller wch takes in params from a form, in the index page, thru select box. category controller def show @category = Category.find_by_sql ["select distinct l.* from listings l , categories c, categories_listings cl where c.id = cl.category_id and l.id = cl.listing_id and c.id in (?,?)" , params[:c][:id1] , params[:c][:id2]] end in the show page, i cannot access the paperclip attribute wch is in the listing model, from the

Rails 4 Paperclip FactoryGirl file uploading

为君一笑 提交于 2019-12-04 13:18:18
问题 I have a FactoryGirl :product factory that uses fixture_file_upload to set image , which is a Paperclip attachment. image { fixture_file_upload "#{Rails.root}/spec/fixtures/images/product.png", 'image/png' } fixture_file_upload works fine, but every time a test creates a new Product using the factory, Paperclip creates a new file in publicproducts/<id>/original.png . This is the issue. . Filling a the folder publicproducts on each test run is not acceptable. The first workaround I can think

Creating JPG thumbnails from PDF causes problems with new version of ImageMagick

有些话、适合烂在心里 提交于 2019-12-04 12:56:26
I'm using Imagemagick to create thumbnails images of pdf files with this command: convert 'input.pdf[0]' -resize "100x140>" -colorspace 'rgb' 'output.jpg' 2>/dev/null Some of the PDFs are in CMYK color space, hence the specification of the expected -colorspace as rgb. This was working fine until I updated to the latest versions of Imagemagick(6.6.7-1) and ghostscript(9.01_0), now it looks like the conversion to rgb isn't working any longer, here is an example output: (The background should be white, not black) It seems though that the problem comes from the -resize option because if I remove

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

一世执手 提交于 2019-12-04 11:44:27
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 ActiveSupport found here on row 164 https://sourcegraph.com/github.com/rails/rails@master/.rubygem

paperclip accepting jpg and png on production

南楼画角 提交于 2019-12-04 11:30:34
I'm using PaperClip plugin in my Rails application as follows: has_attached_file :photo, :styles => {:small => '64X64>', :medium => '250X250>'}, :url => "/assets/user_photos/:id/:style/:basename.:extension", :path => ":rails_root/public/assets/user_photos/:id/:style/:basename.:extension" # validates_attachment_presence :photo validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png','image/gif'] validates_attachment_size :photo, :less_than => 1.megabytes It works fine on development(Mac OSX + Mongrel). But when I put it in production (Linux Debian + Apache/Passenger

Error: Validation failed: Images imageable must exist , rails-5.0 , paperclip-5

天涯浪子 提交于 2019-12-04 10:32:25
问题 While i was trying to submit the form, following error occured: Validation failed: Images imageable must exist and render the same new.html.erb view. If i comment the file field in new.html.erb . Product is being created successfully. ProductsController: def new @product = Product.new end def create @product = Product.create!(product_params) if @product.save redirect_to products_path, notice: "Product Created Successfully" else render "new" end end def product_params params.require(:product)

How to do Rails migration involving Paperclip

让人想犯罪 __ 提交于 2019-12-04 10:29:47
问题 How do people write their Rails migrations that involve Paperclip? I feel that I might be missing something obvious as I have now written my own migration helpers hacks that makes it easier and also take care of doing necessary filesystem changes. And of course you should test run these kinds of migrations in a development (and staging) environment before deploying to production. Paperclip migration rename, add and remove helpers Paperclip change path migration helper (not really a database