Tutorials

A Fresh Cup - Home - Introduction to Active Storage
Today DHH announced Active Storage: a new gem that makes it easy to attach Amazon S3 or Google Cloud Storage files to Active Record model instances. Looks like this is slated to become part of Rails in 5.2. I happen to have a Rails 5.2 application...

rails/activestorage: Store files in Rails applications
A key difference to how Active Storage works compared to other attachment solutions in Rails is through the use of built-in Blob and Attachment models (backed by Active Record). This means existing application models do not need to be modified wit...

Build a query parser (using Ruby, Parslet, and Elasticsearch)
However, it's better to write your own query parser, for two reasons. First, built-in parsers are too powerful. They are confusing and allow users to trigger expensive queries that kill performance. Second, built-in parsers are too generic. There ...

Single file Rails applications (for fun and bug reporting) | Christoph Lupprich
As you might know from previous posts, I keep a Rails playground project around. That’s a small application with a bunch of models, controllers and accompanying tests. It allows me to quickly try out a new gem that was mentioned in a blog post, se...


Rails' CurrentAttributes considered harmful - Ryan Bigg
Very briefly, it makes program state unpredictable.To elaborate, imagine you have a couple of objects that both use the same global variable. Assuming you're not using a source of randomness anywhere within either module, then the output of a part...



WriteCodeEveryday/flynn_auto_scale: Let your Rails apps on Flynn scale to your business needs.
A gem that allows your Rails apps to self-scale as they need more and more resources under Flynn. Comes with an automated mode that can be used for "day to day" web hosting operations and a manual mode where you can control when scaling operations...

WriteCodeEveryday/darnbrokenrails: An attempt at a cybersecurity / code quality teaching tool for Rails.
An attempt at a cybersecurity / code quality teaching tool for Rails.The 'sqlite3' gem is used to prevent this Rails project being hosted in most major online hosts, but this application is 'insecure by design', so care should be taken when enabli...