carrierwave

Rails 5 CarrierWave Gem Works in Production But Not In Development

那年仲夏 提交于 2019-12-23 17:02:46
问题 Gem & Ruby Versions ruby '2.5.3', 'rails', '~> 5.2.1', 'carrierwave', '~> 1.2', '>= 1.2.3' When I upload images in my local development environment, I receive no errors and no images are uploaded, but my same application in my production environment uploads images as it should. I've double checked my settings and cannot see anything out of place and the fact that it works in production has me confused. image_uploader.rb class ImageUploader < CarrierWave::Uploader::Base include CarrierWave:

Rails 5 CarrierWave Gem Works in Production But Not In Development

 ̄綄美尐妖づ 提交于 2019-12-23 16:57:24
问题 Gem & Ruby Versions ruby '2.5.3', 'rails', '~> 5.2.1', 'carrierwave', '~> 1.2', '>= 1.2.3' When I upload images in my local development environment, I receive no errors and no images are uploaded, but my same application in my production environment uploads images as it should. I've double checked my settings and cannot see anything out of place and the fact that it works in production has me confused. image_uploader.rb class ImageUploader < CarrierWave::Uploader::Base include CarrierWave:

Heroku doesn't save uploaded images?

半城伤御伤魂 提交于 2019-12-23 16:52:35
问题 I have a Rails 4 app running on Heroku. I'm using carrierwave and rmagick to upload pictures in to the app itself. The app runs ok and it uploads the pictures and i can use them for about 24 hours, but if I log on the second day the links to the images are broken and it says that it can not find the pictures. The account on Heroku is the basic free account. 回答1: Heroku runs an ephemeral file system - whilst you can write files to it files are lost when dyno's are rebooted (every 24 hours) or

CarrierWave + RMagick Square Crop?

…衆ロ難τιáo~ 提交于 2019-12-23 14:21:03
问题 I am trying to make a fixed square image crop with Ruby on Rails, CarrierWave, and RMagick. I have tried both of the following with no luck... version :thumb do process :resize_to_fit => [200, 200] end and version :thumb do process :resize_to_limit => [200, 200] end resize_to_limit obviously resizes the image to fit within the specified dimensions while retaining the original aspect ratio. So that's not right, but resize_to_fit doesn't do it either. I am looking at all of the available of the

CarrierWave + RMagick Square Crop?

坚强是说给别人听的谎言 提交于 2019-12-23 14:18:19
问题 I am trying to make a fixed square image crop with Ruby on Rails, CarrierWave, and RMagick. I have tried both of the following with no luck... version :thumb do process :resize_to_fit => [200, 200] end and version :thumb do process :resize_to_limit => [200, 200] end resize_to_limit obviously resizes the image to fit within the specified dimensions while retaining the original aspect ratio. So that's not right, but resize_to_fit doesn't do it either. I am looking at all of the available of the

Manually updating attributes mounted by Carrierwave Uploader

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 09:27:52
问题 I am unable to use model.update_attribute on an attribute that is mounted by a carrierwave uploader. The SQL statement wont accept the value and adds NULL to the placeholder. If I remove the mount_uploader statement from the model class it works as normal. I am troubleshooting things from the console and trying to add some attributes while seeding the DB and this is thwarting my efforts. Ideas? Thanks. Update: Relevant code: class Profile < ActiveRecord::Base belongs_to :user has_and_belongs

Workaround for CarrierWave multiple file upload using sqlite3 in development

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 02:52:23
问题 In my team development environment, we are using sqlite3 which comes default in Rails. However, carrierwave's implementation of multi files upload require database that supports array/json datatype. Are there any workaround so that it will work on our development environment without installing other database such as postgres? I'm following the instructions over here https://github.com/carrierwaveuploader/carrierwave#multiple-file-uploads 回答1: The only possible workaround would be to create a

Rails image upload security

[亡魂溺海] 提交于 2019-12-23 01:52:12
问题 Currently, I adopt Carrierwave for users to images. However, I hardly find a solution for image security, i.e. how to set image authorisation for the uploaded images to only let certain user in the same group to view? After digging Facebook's implementation, I observe that they inject these params (oh,oe, __gda_) to the image url ?oh=924eb34394&oe=55E07&__gda__=1436393492fc8bf91e1aec5 Is there any similar implementation for carrierwave or paperclip ? Thanks 回答1: I worked quite a bit with this

Rails carrierwave testing - how to remove file after test?

人走茶凉 提交于 2019-12-23 01:16:32
问题 I am testing the carrierwave upload functionality using rspec and capybara. I have something like: describe "attachment" do let(:local_path) { "my/file/path" } before do attach_file('Attachment file', local_path) click_button "Save changes" end specify {user.attachment.should_not be_nil} it { should have_link('attachment', href: user.attachment_url) } end And this works great. The problem is that after testing the uploaded image remains in my public/uploads directory. How can I remove it

CarrierWave Error

廉价感情. 提交于 2019-12-22 08:59:29
问题 I get an error that looks like this: NoMethodError (undefined method `image_will_change!' for #<Bar:0x24ddda0>): app/controllers/bars_controller.rb:43:in `new' app/controllers/bars_controller.rb:43:in `create' After I click submit for a registration. I am using Carrierwave and have followed the steps to using it, but still have an error. 回答1: CarrierWave doesn't support the attribute_will_change! call, at least I ran into this error a few times. Follow the steps from How to: Detect a new file