11 months ago
You have some multimedia-model (Image/Audio) in your app. The actual files are stored on Amazon S3. And to tie these 2 together you use attachment_fu.
The problem you will have if you work in a team of developers is that, since attachment_fu is expecting one bucket per environment, all developers will write their data to that 'development'-bucket and possibly overwrite each others data.
A fast solution that does not involve hacking the plugin itself is to include this simple line in your model:
If you are in 'development' attachment_fu will look into
The advantage here is that you dont have to change the (probably version controlled) default config file.
The
Don't forget to create the actual buckets on s3 to complete this setup.
comments
The problem you will have if you work in a team of developers is that, since attachment_fu is expecting one bucket per environment, all developers will write their data to that 'development'-bucket and possibly overwrite each others data.
A fast solution that does not involve hacking the plugin itself is to include this simple line in your model:
CONFIG_PATH = RAILS_ENV == 'development' ?
"#{RAILS_ROOT}/config/amazon_s3_dev.yml" : nil
has_attachment :s3_config_path => CONFIG_PATH,
:storage => :s3,
.......
If you are in 'development' attachment_fu will look into
amazon_s3_dev.yml otherwise into the default file amazon_s3.yml.
The advantage here is that you dont have to change the (probably version controlled) default config file.
The
amazon_s3_dev.yml-file should then look sth. like this:
development: bucket_name: social_dev_your_name access_key_id: your_access_key_id secret_access_key: your_secret_access_keyYou can now also remove the development entry from
amazon_s3.yml.
Don't forget to create the actual buckets on s3 to complete this setup.