carrierwave

carrierwave Excon::Errors::SocketError

孤者浪人 提交于 2019-12-10 18:25:52
问题 I have read several posts and solutions related to this, but I still cannot figure it out and still returns " Excon::Errors::SocketError at /posts getaddrinfo: nodename nor servname provided, or not known (SocketError)" this is config/carrierwave.rb CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', # required :aws_access_key_id => '----', # required :aws_secret_access_key => '----', # required :region => 'eu-west-1', # optional, defaults to 'us-east-1' :host =>

How to display a presence validation conditionally in combination with carrierwave?

非 Y 不嫁゛ 提交于 2019-12-10 18:22:00
问题 I've an image model with the following validation validates :image, presence: true, image_size: { width: { min: 400 }, height: { min: 400 } }, :file_size => { :maximum => 5.megabytes.to_i } now I also have a carrierwave validation: def extension_whitelist %w(jpg jpeg gif png) end When I submit a .txt file I get the following: The form contains 2 errors. Image can't be blank Image You are not allowed to upload "txt" files, allowed types: jpg, jpeg, gif, png The first error message shouldn't be

Rails 3 Carrierwave-Fog-S3 error: Expected(200) <=> Actual(404 Not Found)

时间秒杀一切 提交于 2019-12-10 18:07:17
问题 I'm using Carrerwave 0.5.3 and getting a 404 error on my call to Picture.save in the Create method of my picture controller. Per the instructions in lib/carrierwave/storage/s3.rb I have the following in my initialization file (config/initializers/carrierwave_fog.rb): CarrierWave.configure do |config| config.s3_access_key_id = "xxxxx" config.s3_secret_access_key = "xxxxx" config.s3_bucket = "mybucket" #already created in my S3 account end In photo_uploader.rb I have: class PhotoUploader <

How to reference parent model from Carrierwave Uploader object

梦想的初衷 提交于 2019-12-10 16:55:52
问题 I want to run some methods after the upload of a file has been completed via Carrierwave. Carrierwave includes several callback methods detailed here. I'm planning on using the :store callback. That's great, but it requires me to run the callback method in the Uploader object instance. This isn't the end of the world, but I want to keep all the logic inside of my parent Model. My question is: How should I be referencing the parent model from the Uploader? I don't see anything obvious in the

Carrierwave/fog/AWS issue when loading to Heroku “cannot load such file — fog”

一笑奈何 提交于 2019-12-10 16:49:15
问题 So im a total newbie and going through Michael Hartl's rails tutorial. Ive become totally stuck when trying to config picture uploads using carrierwave, fog-aws to S3 AWS. When pushing to heroku I get the following error: LoadError: cannot load such file -- fog As a side note i've tried using the exact same code in development mode, rails server works just fine and I am able to upload files to AWS successfully. So it's not a configuration setup problem with AWS. My problem comes when trying

why when i'm upload image using carrierwave in rails 4 database is rollback?

末鹿安然 提交于 2019-12-10 16:13:28
问题 i try to save image file using carrierwave in rails 4, but when submit button is click database is rollback??? why ? if i dont select image to upload and just send string only, all work properly but if i send image file i get error like this : TypeError: can't cast ActionDispatch::Http::UploadedFile to string: INSERT INTO "items" ("created_at", "description", "image", "name", "store_id", "sub_items", "title", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) (0.2ms) rollback transaction ***

Configuration for Carrierwave with Amazon S3, hosted on Heroku

人走茶凉 提交于 2019-12-10 14:34:41
问题 I've followed the deployment instructions from Carrierwave with how to deploy on Heroku for a Rails app using Amazon S3: https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Make-Carrierwave-work-on-Heroku I've added the extra line to config.ru and created the config/initializers/carrierwave.rb file, but no success. Below is the carrierwave initializer, with keys redacted. Is this correctly setup? What else do I need to do? Any step-by-step guides to help me implement this?

CarrierWave File Uploads not working in rails

匆匆过客 提交于 2019-12-10 14:25:53
问题 I need to upload image to my filme collection application i use carrierwave to do this (follows the railscasts steps) step 1 i add gem 'carrierwave', '~> 0.9' to my Gemfile then run bundle step 2 rails g uploader image then rails g scaffold filmes name moviestype after rake db step 3 rails g migration add_image_to_filmes image:string and then rake db other step are same as railscasts in my filme modle attr_accessible :name, :moviestype, :image mount_uploader :image, ImageUploader in my _form

Modify filename before saving with Carrierwave

ぐ巨炮叔叔 提交于 2019-12-10 13:56:04
问题 I've an uploader where I've implement the #filename method to get a custom and unique filename but it looks like this method is ignored before saving the file (I'm uploading to rackspace with the fog gem) Here is the uploader: class MyImageUploader < CarrierWave::Uploader::Base include CarrierWave::RMagick ... def filename if original_filename.present? "#{secure_token}.#{file.path.split('.').last.downcase}" else super end end ... private def secure_token var = :"@#{mounted_as}_secure_token"

How to get the real file from S3 using CarrierWave

一个人想着一个人 提交于 2019-12-10 13:46:26
问题 I have an application that reads the content of a file and indexes it. I was storing them in the disk itself, but now I'm using Amazon S3, so the following method doesn't work anymore. It was something like this: def perform(docId) @document = Document.find(docId) if @document.file? #You should't create a new version @document.versionless do |doc| @document.file_content = Cloudoc::Extractor.new.extract(@document.file.file) @document.save end end end @document.file returns the FileUploader ,