carrierwave

CarrierWave full url for default image

a 夏天 提交于 2019-12-22 06:56:23
问题 I am using CarrierWave for image uploads on a rails-api application which in turn is consumed by a backbone.js client app. I notice that when there is no default image available it returns /assets/default.png . It in turn has to be http://dev-server:3000/assets/default.png . Here are my configuration settings: # config/environments/development.rb CarrierWave.configure do |config| config.asset_host = "http://dev-server:3000" end # Image Uploader .... def default_url "/assets/default.png" end

ActiveRecord::UnknownAttributeError

二次信任 提交于 2019-12-21 16:52:15
问题 I'm trying to create hotel with some fields, one of the fields is photo, i want to use multiple files upload with carrierwave and nested_form. I found this article and have some result. When i'm on /hotels/new, filling fields, choosing photos and press submit, getting ActiveRecord::UnknownAttributeError in HotelsController#create unknown attribute: attachable_type. Console Started POST "/hotels" for 127.0.0.1 at 2013-09-27 17:35:18 +0300 Processing by HotelsController#create as HTML

carrierwave, Excon::Errors::MovedPermanently in RegistrationsController#update error

风流意气都作罢 提交于 2019-12-21 11:26:29
问题 ive been trying to get carrierwave to work with amazon s3. instead of storage :s3 i have storage :fog changing it to storage :s3 gives an immediate error https://stackoverflow.com/questions/10629827/carrierwave-cant-convert-nil-into-string-typeerror-when-using-s3 so i changed it to storage :fog like the rdoc below says. http://rubydoc.info/gems/carrierwave/frames however when i try to upload an image, i get this crazy error. im using the devise gem as well. my full stack trace is Excon:

Verifying a remote image is actually an image file in ruby?

筅森魡賤 提交于 2019-12-21 07:41:27
问题 I'm trying to figure out how I can verify what I'm feeding into carrierwave is actually an image. The source I'm getting my image urls from isn't giving me back all live urls. Some of the images no longer exist. Unfortunately it doesn't really return the right status codes or anything because I was using some code to check if the remote file exists and it was passing that check. So now just to be on the safe side I'd like a way to verify i'm getting back a valid image file before I go ahead

Verifying a remote image is actually an image file in ruby?

二次信任 提交于 2019-12-21 07:41:27
问题 I'm trying to figure out how I can verify what I'm feeding into carrierwave is actually an image. The source I'm getting my image urls from isn't giving me back all live urls. Some of the images no longer exist. Unfortunately it doesn't really return the right status codes or anything because I was using some code to check if the remote file exists and it was passing that check. So now just to be on the safe side I'd like a way to verify i'm getting back a valid image file before I go ahead

Rails] Images erased after a new commit on heroku

╄→尐↘猪︶ㄣ 提交于 2019-12-21 06:09:18
问题 I'm using Carrierwave to upload images, and my app is on Heroku right now. Images are uploaded successfully unless I push a new commit to heroku. Images that I uploaded before a push seem to be erased when a new commit comes in. Does anyone know the reason behind and how to fix this issue? Update: The problem becomes, using carrierwave on Heroku without a storage server like Amazon EC3 . Heroku does not save files in public folder, where carrierwave uploads by default. app/uploaders/image

Rails] Images erased after a new commit on heroku

北城余情 提交于 2019-12-21 06:09:17
问题 I'm using Carrierwave to upload images, and my app is on Heroku right now. Images are uploaded successfully unless I push a new commit to heroku. Images that I uploaded before a push seem to be erased when a new commit comes in. Does anyone know the reason behind and how to fix this issue? Update: The problem becomes, using carrierwave on Heroku without a storage server like Amazon EC3 . Heroku does not save files in public folder, where carrierwave uploads by default. app/uploaders/image

CarrierWave::FormNotMultipart error when creating records using seed.rb file

旧城冷巷雨未停 提交于 2019-12-21 04:23:05
问题 I have a model that has a image column. I am using CarrierWave to upload images (I am following this rails cast to do this. Now, I want to create some default records using seed.rb file but I have failed to provided correct parh/url to the images. So, I have images in List item app/public/images/ folder and this is the code from the seed.rb file: gems = { test1: { name: 'test1', description: 'test1', image: '/public/images/test1.png', }, test2: { name: 'test2', description: 'test2', image: '

How to send file to user with carrierwave?

江枫思渺然 提交于 2019-12-21 04:16:10
问题 Here's my old code to sends a file to the browser: def show send_file File.join(Rails.root, 'tmp', 'price.xls') end But recently I've found out that tmp folder can't be used as a persistent storage on Heroku, so I decided to move the file to AWS S3. That's what I've got so far: def show uploader = PriceUploader.new uploader.retrieve_from_store!('price.xls') end Now, how do I send the file to the browser? upd I itentionally didn't mount the uploader 回答1: Figured it out. def show uploader =

Does the Ruby on Rails CarrierWave gem work with Ajax?

跟風遠走 提交于 2019-12-21 03:45:56
问题 For some reason using the CarrierWave gem with Ajax doesn't seem to be working for me. Am I doing something wrong? I followed the 253 CarrierWave Railscast well and it works without AJAX but in my application I need to use AJAX. Here is my code: The params list after selecting a jpeg in the image file field: Parameters: {"item"=>{"remote_image_url"=>""}} new.html.erb: <%= form_for(@item, :url => create_item_path, :html => {:id => "create_item_form", :multipart => true}) do |f| %> <p> <%= f