Skip to content

Instantly share code, notes, and snippets.

@nakamuraagatha
Last active September 14, 2018 00:16
Show Gist options
  • Save nakamuraagatha/6c23edd0ef4e8d79866e to your computer and use it in GitHub Desktop.
Save nakamuraagatha/6c23edd0ef4e8d79866e to your computer and use it in GitHub Desktop.
Spina CMS with Cloudinary
rails generate uploader Web
#config/cloudinary.yml
development:
cloud_name: yourcloudname
api_key: 'cloudinary_api_key'
api_secret: cloudinary_api_secret
enhance_image_tag: true
static_image_support: false
production:
cloud_name: yourcloudname
api_key: 'cloudinary_api_key'
api_secret: cloudinary_api_secret
enhance_image_tag: true
static_image_support: true
test:
cloud_name: yourcloudname
api_key: 'cloudinary_api_key'
api_secret: cloudinary_api_secret
enhance_image_tag: true
static_image_support: false
#config/initializers/spina.rb
Spina::Engine.configure do
config.NEGATIVE_CAPTCHA_SECRET = 'b1cff6622e8739544d33cf5344102839d09e7e7f2cb5494a2055600d7b05ea1135f5fc0ac7cd0205fc9a2f09e01f143dc506f3f721209503ed6c41fe0520e93a'
# If you want to use s3 to store uploads
config.storage = :cloudinary
config.cloud_name = "cloudname"
config.api_key = "cloudinary_api_key"
config.api_secret = "cloudinary_api_secret"
config.enhance_image_tag = "true"
config.static_image_support = "false"
end
#app/uploaders/web_uploader.rb
class WebUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment