Skip to content
Write Software, Well
  • Services
  • Books
  • LinkedIn
  • Archive
  • About
Sign in Subscribe
Add custom flash types in Rails

How to Create Custom Flash Types in Rails

While reading the Rails codebase last week, I came across a useful method that lets you create custom flash types. In this post, we'll learn how to use it and also how it's implemented behind the scenes. In the process, we'll also learn a few metaprogramming tricks in Ruby.

4 min read
Inline Routes in Rails

Inline Routes in Rails

If you want to quickly try out some Rails feature or code in the browser without spinning up a whole new controller and a view, simply map the incoming request to a lambda Rack endpoint, i.e. a lambda that returns the status, headers, and response body.

3 min read
sharpened pencil

Simplifying My Blogging Workflow with Ruby

This is the 100th post on this blog 🎉 I wanted to share how a simple Ruby script simplified my blogging workflow and dramatically increased the number of posts I write on my various blogs.

3 min read
dog with a ball

Did You Know that You Can Catch and Throw Stuff in Ruby?

Unlike traditional programming languages, Ruby's throw and catch are not used to raise and catch exceptions. Instead, they let you escape from deeply nested control flows. This post shows how `throw-catch` works in Ruby with practical, real-world examples, including their usage by the Warden gem.

7 min read
ways to run shells commands in Ruby

Various Ways to Run Shell Commands in Ruby

Ruby provides multiple ways to conveniently execute external processes from the code. In this article, we'll learn all the ways you can run shell commands in Ruby and also consider various circumstances under which you'd choose one over the other.

5 min read
Ruby's Switch Statement is More Flexible Than You Thought

Ruby's Switch Statement is More Flexible Than You Thought

Ruby's switch statement is very versatile and flexible, especially due to the dynamic nature of Ruby. In this post, we'll see how you can use it in various ways. We'll also learn why it works the way it works. Hint: it uses the `===` operator (method) under the hood.

4 min read
Can you spot the error in this Ruby code?

Can You Spot the Error?

I recently encountered this error and in the process of debugging, learned some useful stuff about `self` and how assignment works in Ruby. See if you can figure it out yourself. Can you spot the error in this simple Ruby snippet?

2 min read
Books to learn programming with Ruby and Rails

A List of Books to Learn Programming with Ruby and Rails

This post provides a curated list of books to learn to code in Ruby and build web applications with Rails. It also gives a step-by-step path you can follow to learn enough before moving to the next step. If you ever wanted to learn to program but didn't know where to start, this post is for you.

9 min read
Using OrderedOption to access hash values as methods

How to Access Hash Values with Methods Using OrderedOptions

Have you ever wanted to create a hash where you could access the values like methods on an object? The OrderedOptions class in Rails lets you do just that. This post shows you how. We'll also explore how Rails implements this feature using Ruby's metaprogramming features.

Rails Internals 5 min read
The Definitive Guide to Rack for Rails Developers

The Definitive Guide to Rack for Rails Developers

The word Rack actually refers to two things: a protocol and a gem. This article explains pretty much everything you need to know about Rack as a Rails developer. We will start by understanding the problem Rack solves and move to more advanced concepts like middleware and the Rack DSL.

This article is for Members only

12 min read

Readonly Attributes in Rails

In this article, we'll learn how to mark certain attributes as readonly on your active record models, to prevent them from any future updates after the record is created and saved to the database. We'll also learn how Rails implements this feature behind the scenes.

Rails Internals 3 min read
Sessions in Rails: Everything You Need to Know

Sessions in Rails: Everything You Need to Know

In this post, we’ll learn about Rails sessions, including what is a session, why we need them, and why they're so important. I’ll also take you behind the scenes and show you how Rails implements sessions and where the `session` method actually comes from. Hint: it’s not in the Rails codebase.

10 min read

Page 11 of 17

Load More Something went wrong with loading more posts
  • Sign up
  • Homepage

© Write Software, Well 2025 - Powered by Ghost