ruby

S3: A Flexible Approach to Uploading in Rails

S3: A Flexible Approach to Uploading in Rails

S3, Amazon’s Simple Storage Service, is a cheap, scalable, highly available, and overall great solution for storing huge bits of data and thus reducing your database size. For a while now, we’ve realized that our database is on its path to becoming expensive and unmanageable due its massive size. So we decided to migrate some of that data over to S3. In this article, I explain the approach we took to make any attribute S3able
Dry Schema: Decouple Validations from Rails Models

Dry Schema: Decouple Validations from Rails Models

Standard Ruby on Rails best practices suggest that we should define our validations on the model object. RoR gives you the tool, aka DSL (domain specific language), to implement these validations. For simple situations, say a signup form, this works really well, but what about more complicated scenarios? What if your model serves several different controllers? Or what if, for example, different types of users could submit different values to the same model? Do we want to use messy ifblocks to check the user type and apply the correct set of validations? Probably not. So what’s the solution? Enter Dry-schema.

Trailblazer 2.1: Activity, the new Operation!

Trailblazer 2.1: Activity, the new Operation!

In Trailblazer 2.1, we are introduced to a new concept: Activity.

Unlike Trailblazer 2.0, where Operation was king, activities have taken over as the main orchestrator of business logic. Good old operations are still there, but now they act as a wrapper around activities. Its one and the same, except activities are more powerful! Don’t worry though, its super easy to pick up and its backward compatibility makes switching a breaze.