Write Software, Well
Akshay
My name is Akshay, and I'm a software developer living in beautiful Victoria, British Columbia. I grew up in India, but Canada has been my home for the past 10 years. I am married to Pratiksha and we have a daughter, Suhani. I love programming in Ruby and building web applications with Rails. This blog is my attempt to share my learnings and to spread the joy of programming in Ruby with the world. Every day, I try to learn something new in Ruby and Rails and write about it.
October 2026
Top Words
- rails
- active
- storage
- internals
- understanding
- helper
- working
- freelancing
- developers
- redirects
- manual
- render
All posts (43)
Active Storage uses two main models: blobs and attachments. Blobs store the uploaded file's metadata and a link to the actual file, while attachments link those files to records. Understanding how they work together makes it easier to manage uploads, generate URLs, and process uploaded files.
Active Storage is a wonderful library for managing file uploads in Rails. But terms like blob and attachment are easy to mix up, and that confusion can remain even after you’ve been using Active Storage regularly. I’ve run into that myself. I’ve used Active Storage for a long time in several projects, without ever...
Localhost is treated as a trustworthy origin even without TLS, so all apps on localhost run in a secure context. This allows secure features to work in development. You can also run multiple apps on localhost with subdomains + ports to separate them. When you do need local HTTPS, use Caddy server.
TL;DR: You can and should use localhost in development. Browsers give a special treatment to the http://localhost domain. Even though it's on HTTP, most of the time it will be treated as HTTPS. So any browser APIs that need HTTPS, will continue working even if you're using localhost. When you do need HTTPS locally,...
A sitemap lists your site's pages, helping Google crawl it efficiently. It's especially useful for large sites or new sites with zero backlinks. This post shows how you can create one in your Rails site, how to add it to Google Search Console, and how to index new pages as soon as you publish them.
I recently added sitemaps to a few Rails-based marketing sites I manage for clients, and within weeks, we saw a noticeable boost in search traffic. It reminded me that not many people know about them or have totally forgotten about them (it's quite an old but effective SEO technique). Even fewer know about Google...
The Rails router's direct method lets you create custom url and path helpers, which is especially useful for polymorphic models and delegated types. This post shows how to use a single custom helper to generate URLs for different models, with a practical example from the open source Maybe project.
While reading the source code for the Maybe project (which is a really good Rails codebase that follows most of the Rails best practices and conventions), I came across this code in the router config file. It uses the Rails routing feature called direct to create custom URL helpers for a polymorphic model.direct...
I started as a sceptic, but now I'm a convert and a heavy user of AI for everyday programming, and wanted to write down some common patterns and prompts for working with AI tools that I’ve found useful in my own development workflow as well as those I learned from other experienced developers.
Over the past year, I’ve started heavily using AI tools like Cursor and ChatGPT in my everyday development workflow. They’re not a replacement for thinking, but I found them as excellent assistants for learning, debugging, refactoring, and accelerating implementation work.I wanted to write down some common patterns...
This post shows how to inspect the sequence of before, after, and around callbacks in Rails controllers by adding a small initializer. Useful for understanding callback order in applications with complex controller hierarchies or shared concerns. I learned this trick while reading the Rails tests.
While debugging a Rails app, sometimes it's useful to see the full list of callbacks that are set to run before, after, or around a controller action, in the exact sequence they will run. This is especially true in applications with a deep controller inheritance hierarchy or a heavy use of concerns with conditional...
Page 2 of 4