← Back to Upcase

Set a default image in CarrierWave

(Chuckblake ) #1


I want to set a default image for a CarrierWave field. The image will be set to one of several defaults (based on a category previously selected).

I tried, writing and saving the image name directly on the ActiveRecord field name but it’s not saving (I’m assuming that the CarrierWave object is expecting a file to process, not a string).

Any ideas on how I can go about setting a default image?


(Pedro Moreira) #2

@chuckblake would this be of help: https://github.com/carrierwaveuploader/carrierwave#providing-a-default-url ?

You can probably create fallback paths to support the several defaults.

(Chuckblake ) #3

thanks, I’ll check that out.