Skip to content
Write Software, Well
  • Services
  • Books
  • LinkedIn
  • Archive
  • About
Sign in Subscribe
Binding in Ruby

Understanding the Concept of Binding in Ruby

Binding is an elegant way to access the current scope (variables, methods, and self) in Ruby. Typically, you use it for building view templates and executing strings of Ruby code. The Ruby REPL also makes abundant use of binding. In this post, we'll learn what binding is and how it works.

4 min read
Serving static files in Ruby

Serving Static Files in Ruby

This is the fourth article in the series where we build a simple, yet complete web app in plain Ruby, without using Rails to better understand how Rails works. In this article, we'll learn how to serve static files in plain Ruby, without using Rails.

This article is for Members only

Rails Companion 7 min read
split a list into n-equal parts in ruby and rails

How to Split a List into N Equal Parts in Ruby (and Rails)

This article shows you can split (or chunk) a list of items into n-equally sized parts using the `each_slice` method in Ruby and `in_groups_of` method in Rails.

2 min read
block, proc, and lambda in Ruby

Blocks, Procs, and Lambdas: A Beginner's Guide to Closures and Anonymous Functions in Ruby

Closures and anonymous functions are very useful concepts, especially in functional programming. Ruby makes working with them a pleasure via its flavors like blocks, procs, and lambdas. This post provides an in-depth tutorial and shows the subtle differences between them.

10 min read
Autoloading Modules in Ruby and Rails

How Module Autoloading Works in Ruby and Rails

Autoloading allows you to speed up the initialization of your library by lazily loading the code only when you need it. This post explains how the autoload method works in Ruby and how Rails overrides this method to provide its own implementation that follows the Rails naming conventions.

Rails Internals 4 min read
Stimulus JavaScript Library

Practical Stimulus: How to Toggle CSS Classes

This second article in the 'Stimulus in Practice' series shows how you can work with HTML classes using Stimulus. Specifically, we'll learn how to toggle classes on an element. This is useful when you want to show or hide certain elements or update the design in response to user interaction.

Practical Stimulus 5 min read
Stimulus JavaScript Library

Practical Stimulus: Capture User Input

Stimulus is a JavaScript library that works really well with the HTML-over-the-wire approach of building web applications. In this series of articles, we'll learn how to accomplish common front-end tasks using Stimulus. This post shows how to capture user input and display it on the screen.

Practical Stimulus 6 min read

Unix: A History and a Memoir

I recently read Brian Kernighan’s Unix: A History and a Memoir. If his name sounds familiar, Brian is also the author of The C

1 min read
How to Create a Form with Multiple Submit Buttons to Different URL Endpoints

How to Create a Form with Multiple Submit Buttons to Different URL Endpoints

I came upon an interesting problem at work yesterday. A 'search filters' form needed to have two endpoints to which it could submit:

2 min read
has_secure_token demo in Rails

Generating Secure Tokens on Your ActiveRecord Models

You must have used the `has_secure_password` macro in Rails. Did you know Rails also provides a `has_secure_token` macro to generate unique tokens on your models? In this article, we'll learn how it works and we'll also see how Rails implements it behind the scenes.

Rails Internals 3 min read
Rendering Markdown Views in Rails

How to Render Markdown Views in Rails

This article shows how to create and render markdown views in Rails. This is useful if you have a few static marketing pages in your web application that you'd like to save and edit as markdown along with the rest of your code files.

2 min read
A Taggable Concern in Rails

Concerns in Rails: Everything You Need to Know

Concerns are an important concept in Rails that can be confusing to understand for those new to Rails as well as seasoned practitioners. This post explains what concerns are, how they work, and how & when you should use them to simplify your code, with practical, real-world examples.

9 min read

Page 10 of 17

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

© Write Software, Well 2025 - Powered by Ghost