ckeditor与carrierwave上传图片到upyun
参考:https://github.com/nowa/carrierwave-upyun
-
在Gemfile中:
gem 'carrierwave' gem 'carrierwave-upyun'
-
在config/initializers/carrierwave.rb中,增加:
CarrierWave.configure do |config| config.storage = :upyun config.upyun_username = "xxxxxx" config.upyun_password = 'xxxxxx' config.upyun_bucket = "my_bucket" config.upyun_bucket_host = "http://my_bucket.files.example.com" end
-
在对应的uploader中, 使用
storage :upyun
:
class AvatarUploader < CarrierWave::Uploader::Base storage :upyun end