Skip to content
Exports all rows of a Rails model as a CSV file to Amazon S3
Ruby JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Gemfile.lock
Guardfile
MIT-LICENSE
README.md
Rakefile
export_to_cloud.gemspec

README.md

export_to_cloud

export_to_cloud provides a simple way to export all rows of an ActiveRecord model in Rails to Amazon S3 as a time-stamped CSV file.

Usage

Require the gem

gem 'export_to_cloud'

Configure

Create an initializer in 'config/initializers' called something like 'export_to_cloud.rb'. Set the following config variables:

ExportToCloud.aws_access_key_id = "your_access_id"
ExportToCloud.aws_secret_access_key = "your_secret_key"
ExportToCloud.s3_bucket = "your_bucket_name"
ExportToCloud.path = "path/to/directory/in/bucket/"

Call

Call the method on any of your models, like so...

Person.export_to_cloud

I usually make this call in a cron job or manually via the console.

That's it!

To-do

Add some tests. If anyone has an idea how to pull if off, given the S3 integration, I'm all ears :)

Something went wrong with that request. Please try again.