-
Notifications
You must be signed in to change notification settings - Fork 2
How to: Make CarrierWave work with Padrino
There are a few interesting things about using CarrierWave with Padrino which you'll need to know in order to get them to work together seamlessly.
First, you can require CarrierWave like this in your Padrino application's gem file:
gem 'carrierwave', :require => 'carrierwave'
If you want to require a specific ORM to work with CarrierWave, you can put that in the Gemfile too:
gem 'carrierwave', :require => %w(carrierwave carrierwave/orm/activerecord)
Your uploaders will be automatically required if you put them in the lib/
folder.
In versions of CarrierWave prior to 0.5.8, CarrierWave.root never gets set during the Padrino boot sequence, so you may see errors like this when using CarrierWave with Padrino:
TypeError: can't convert nil into String
To avoid this, put the following code into your config/boot.rb file (or app/app.rb file):
CarrierWave.root = File.join(Padrino.root, "public")
This has been fixed in trunk, but it's worth knowing about if you're running across this in an earlier version.