carrierwave

undefined method `fog_host='

江枫思渺然 提交于 2019-12-04 17:29:37
问题 When i'm trying to run my application, i'm getting the following error: config/initializers/carrierwave.rb:4: undefined method `fog_host=' for CarrierWave::Uploader::Base:Class (NoMethodError) Here is my initializers/carrierwave.rb file: CarrierWave.configure do |config| config.storage = :fog config.fog_directory = 'media.domain.pl' config.fog_host = 'http://s3-eu-west-1.amazonaws.com/media.domain.pl' config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => '***', :aws_secret

Getting PDF from WickedPDF for attachment via Carrierwave

大城市里の小女人 提交于 2019-12-04 16:31:34
问题 In Rails3, I am using the WickedPDF gem to render a PDF format of one of my models. This is working fine: /invoices/123 returns HTML, /invoices/123.pdf downloads a PDF. In my Invoice model, I am using the state_machine gem to keep track of Invoice status. When an invoice goes from "unbilled" to "billed" state, I would like to grab a copy of the invoice PDF and attach it to the invoice model using CarrierWave. I have the three parts working separately: the controller creates a PDF view, the

Capistrano and Carrierwave

纵饮孤独 提交于 2019-12-04 16:31:18
I'm deploying a Ruby on Rails and NodeJS application using Capistrano. The uploads folder gets removed on every deploy. This popped up on several places but it doesn't seem to work: # Keep File Uploads task :symlink_uploads do run "ln -nfs #{shared_path}/rails/uploads #{release_path}/rails/public/uploads" end after 'deploy:update_code', 'deploy:symlink_uploads' the repo: repo: /node /rails Thanks! Make sure you remove the existing public/uploads folder, passing -f to ln doesn't cover removing target directories (or at least hasn't done so portably for me) My symlink directories tasks normally

How to upload custom S3 metadata with Carrierwave

微笑、不失礼 提交于 2019-12-04 14:37:22
I want to add Content-Disposition header to a file I'm uploading with carrierwave (it's not an option to do it afterwards via query param in the URL). Is there something I can add to the AttachmentUploader model that would help me accomplish this, before the file is uploaded? Thanks! You can set attributes either globally in your Carrierwave config - CarrierWave.configure do |config| config.fog_attributes = {'Content-Disposition' => ...} end or you can define it on the uploader class itself def fog_attributes {'Content-Disposition' => ...} end and the method on the uploader can use data

Uploading large files on Heroku with Carrierwave

爷,独闯天下 提交于 2019-12-04 14:28:50
问题 I'm about to embark on a hobby project where I'll upload lots of files to S3. Some of the files will be large 50-100MB. I would like to use Heroku but can fallback on EC2 instead if needed. Will Heroku + Carrierwave + S3 work for this? Or are there limitations to file uploads? If so what's a good alternative? Also curious if there are any cool uploading libraries like uploadify but w/o the flash. Thanks! 回答1: I recommend taking advantage of S3's direct-upload feature. This will allow your

Rails image_tag rotates image

北战南征 提交于 2019-12-04 13:11:38
I am using Amazon's S3 for image storage with carrierwave and fog configured. The images seem to store correctly however when I have a 'portrait' image (smaller width than height) it is not displaying correctly, but rather rotating the image on its side. Any pointers in the right direction would be much appreciated! uploaders/image_uploader.rb class ImageUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick include Sprockets::Helpers::RailsHelper include Sprockets::Helpers::IsolatedHelper storage :fog include CarrierWave::MimeTypes process :set_content_type process :resize_to

Direct Uploads to S3 using Carrierwave

眉间皱痕 提交于 2019-12-04 13:05:06
问题 I've recently converted the below from using Paperclip to Carrierwave uploading to Amazon S3 so I can make use of the carrierwave_direct gem and then Sidekiq or another background processing gem. class Release < ActiveRecord::Base has_many :releases_tracks, :dependent => :destroy has_many :tracks, :through => :releases_tracks, :order => "releases_tracks.position DESC" accepts_nested_attributes_for :tracks, :reject_if => lambda { |a| a[:name].blank? }, :allow_destroy => :true accepts_nested

How do I skip a carrierwave store callback when processing versions

£可爱£侵袭症+ 提交于 2019-12-04 12:53:51
I have a callback defined in my video uploader class of carrierwave after :store, :my_method and I have three versions of the files. original , standard , low my_method executes when each version is processed ie, three times, I just need the callback to execute once. I know this is a very late response but I was just having the same problem lately so I decided to post how I solved this "problem" since it seems it isn't documented on carrierwave's github page (or I wasn't able to find it anyway). Ok, regarding the after :store, :my_method callback if you place it in the "main body" of your

CarrierWave: create 1 uploader for multiple types of files

假如想象 提交于 2019-12-04 11:56:08
问题 I want to create 1 uploader for multiple types of files (images, pdf, video) For each content_type will different actions How I can define what content_type of file? For example: if image? version :thumb do process :proper_resize end elsif video? version :thumb do something end end 回答1: I came across this, and it looks like an example of how to solve this problem: https://gist.github.com/995663. The uploader first gets loaded when you call mount_uploader , at which point things like if image?

Carrierwave / Fog / S3 “is not a recognized storage provider”

百般思念 提交于 2019-12-04 11:15:09
问题 I have a Rails app that is using Carrierwave for file uploads. It has been working fine but I want to start using Amazon S3 for my image storage. I am getting this error: ArgumentError ( is not a recognized storage provider): app/controllers/salons_controller.rb:52:in `update' I have made sure I have the latest gems for Carrierwave and Fog. This is in my Gemfile: gem 'carrierwave' gem 'aws-sdk' gem 'fog' fog.rb looks like: CarrierWave.configure do |config| config.fog_credentials = { :provider