Created
February 16, 2015 19:31
-
-
Save darrenboyd/feb2bc38f46a88e44b8d to your computer and use it in GitHub Desktop.
Setup carrierwave in Rails with just fog-aws.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# inside application.rb... | |
class Application < Rails::Application | |
# TODO Stop-gap workaround to carrierwave doing "require 'fog'" | |
# This let's us get ./lib in the load path, where our own | |
# fog.rb is loaded for carrierwave, but we've already loaded | |
# fog-aws, which is all we need anyway. | |
config.before_configuration do | |
require 'carrierwave' | |
end | |
# ... the rest of your config ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/carrierwave.rb | |
require 'fog/aws' | |
CarrierWave.configure do |config| | |
# ... your usual configuration ... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lib/fog.rb | |
module Fog | |
# This file only exists so carrierwave has | |
# something to require. | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# your Gemfile should look something like... | |
gem 'fog-aws', require: false # or require: 'fog/aws' | |
# avoid having carrierwave loading during bundler | |
# setup. We need to get ./lib in the load_path first. | |
gem 'carrierwave', require: false |
@jasonfine You're right, thanks for pointing that out. It seems that fog_provider was deprecated in carrierwave 2.0.0 according to https://github.com/carrierwaveuploader/carrierwave/blob/f81bb4d90c610c4e5d68c2057ab977620d7089a1/CHANGELOG.md#deprecated
"...just adding fog providers to Gemfile will load them" in carrierwave >= 2.0
Current solution in readme: https://github.com/carrierwaveuploader/carrierwave#using-amazon-s3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@gugl The docs don't mention that