Category Archives: Ruby

Optimising specs for ActiveRecord scopes and other database-dependent functionality

After recently switching to a lower-performance laptop for my regular development tasks, I decided to spend a bit of time cleaning up some long-running rspec examples. I found that some misunderstanding of rspec’s features had led me to write highly inefficient specs.
Continue reading Optimising specs for ActiveRecord scopes and other database-dependent functionality

Uploading directly to Amazon S3 from a Rails application

The use cases for Superhug are heavy on uploading and downloading large(ish) files. Rails itself isn’t so well suited to this sort of task, and it’s best to keep state away from application servers wherever possible. We chose to use Amazon S3 and CloudFront to bypass Rails for all of the uploading, downloading and image processing grunt work. This is a rundown of the approach we took.
Continue reading Uploading directly to Amazon S3 from a Rails application