On Sat, Mar 12, 2011 at 11:29 AM, nishant nigam <[email protected]>wrote:

> Bryan i did those changes ...i dont know how to change the main uploader
> code from where the file will upload..


 Everything is explained right in the documentation. If you installed fog
and have an Amazon S3 account to provide as the fog credentials and fog
directory then following the below steps in the documentation is easy. From
the Carrierwave documentation (https://github.com/jnicklas/carrierwave):

Using Amazon S3

Fog <http://github.com/geemus/fog> is used to support Amazon S3. Ensure you
have it installed:

    gem install fog

 You’ll need to provide your fog_credentials and a fog_directory (also known
as a bucket) in an initializer. You can also pass in additional options, as
documented fully in lib/storage/fog.rb. Here’s a full example:

    CarrierWave.configure do |config|
      config.fog_credentials = {
        :provider               => 'AWS',       # required
        :aws_access_key_id      => 'xxx',       # required
        :aws_secret_access_key  => 'yyy',       # required
        :region                 => 'eu-west-1'  # optional, defaults
to 'us-east-1'
      }
      config.fog_directory  = 'name_of_directory'                     # required
      config.fog_host       = 'https://assets.example.com'
# optional, defaults to nil
      config.fog_public     = false
# optional, defaults to true
      config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
# optional, defaults to {}
    end

 In your uploader, set the storage to :fog

    class AvatarUploader < CarrierWave::Uploader::Base
      storage :fog
    end

 That’s it! You can still use the CarrierWave::Uploader#url method to return
the url to the file on Amazon S3.


> and i also need to write the rspec test cases for the same..
>
>
You will need to write them yourself. That is the job you accepted for the
client you are doing the work for. If you have errors in your tests or
errors when they run feel free to post the error you are getting to the
group for help in debugging.

B.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to