Hey! My name's Ayush.
I'm a freelance web developer and author of The Rails and Hotwire Codex.
I also run a privacy-focused mailing list app called Scattergun, co-host Just A Spec, and am part of Bridgetown core.
Hey! My name's Ayush.
I'm a freelance web developer and author of The Rails and Hotwire Codex.
I also run a privacy-focused mailing list app called Scattergun, co-host Just A Spec, and am part of Bridgetown core.
I’ve recently dipped my toe into deploying Ruby and Rails apps to a VPS, mainly to improve the deployment story for Bridgetown. No PaaS is all the rage with Rails 8, and…
In 2020, as a vehicle to learn Rails, I built my first commercial product called Chapter24. It was a super simple blogging platform, my response to the enshittification of Medium.
It’s been over a year since the initial release of The Rails and Hotwire Codex. A lot has changed since then.
The last quarter of 2023 saw the release of Rails 7.1 and the long-awaited Strada…
I’m generally a rather pedantic person and this is supercharged when it comes to managing the git history on my projects. I used GitHub’s squash and merge for a while before…
When developing for the web, we can send the user to any location during a web request using an HTTP redirect (3xx
status codes). Turbo Native effectively wraps the website within native navigation. This means a redirect…
Turbo Streams are a great match-up for Action Cable as it makes it easy to broadcast DOM updates to the browser over WebSockets. The turbo-rails
gem integrates with Action Cable to facilitate…
Concerns are a great way to organize and de-duplicate code in Rails.
One of my favorite use cases is to abstract everything out of the ApplicationController
into concerns. This begs the question…
Rails system tests simulate a user’s actions in a web browser so it’s akin to the app’s real world usage. In a responsive app, this means testing on multiple screen sizes as well.
Capybara, the tool used by system tests…
When something goes wrong in Rails, the user sees a rather boring default error page.
This page lives in the /public
folder and hence isn’t rendered through the Rails stack. To jazz up this page a bit…
Rails 7 includes the official Ruby debugger. It also uses Foreman to orchestrate multiple processes in development. This way you can run the Rails server along with processes to watch and…
The Turbo docs state that the response to a form submission must be 303 See Other
unless something goes wrong.
The reason behind this is the spec for 302 Found
states that the redirected request should use the same HTTP method…
The default HTML file field is rather boring. It’s quite painful to style and not really flexible either.
With a little bit of JavaScript though, we can spice up the file input field a bit and add a preview pane for images…
Kredis is a library that provides an abstraction of higher level data structures for Redis. It’s really useful and will be included in Rails 7.
I like to namespace all my keys in Redis because it prevents clashes…
Serialising a Ruby object to YAML is dead simple. Ruby’s standard library has a yaml
module built in which uses Psych under the hood. All we need to do is require 'yaml'
and we’re good to go! But…
Hamburger icons are pretty ubiquitous these days but I sometimes find them to be a symptom of lazy design. However it’s quite easy to make them a little more interesting…
If you’re familiar with Stimulus at all, the below bog standard controller should look very familiar. In fact I’ve nicked it from their homepage…
Ruby has got to be one of the most malleable programming languages out there, which is why I like it so much.
Recently I was adding breadcrumbs to a Rails app and wrote…
<details>
and <summary>
tags are among of the most useful tags that HTML gives us. I’m constantly surprised by how esoteric they are in practice.
In its simplest use case, the <details>
tag gives us an “open/close” toggle control…
Exporting to PDF from HTML can be a bit of a can of worms, especially with CSS not quite working the way it does in a web browser. However with the right setup, it’s possible to take the pain out of it…
Bridgetown v0.21 includes a new CLI tool to manage Webpack so any improvements and updates to the Webpack config in later Bridgetown versions can be applied easily…
Monkey patching is one of Ruby’s most powerful features. It allows programmers to add methods to core classes which can result in some very elegant APIs. However it’s quite easy to…
Ruby modules are a great way to define mixins. This construct offers a way to share logic using composition.
As it is usually the case with Ruby, there’s two ways…
Sometimes an array of data needs to be submitted in an HTML form. A form to send invites to a bunch of users for example. That’d just be a series of email fields; and in the controller; we’d want an array of the emails…
rake has a variety of uses in Rails applications. You can use them to define and run installation and setup scripts, deployment scripts and pretty much anything you’d want…
pjax
has got to be one of the most underrated programming techniques on the modern web. You can get a sizeable performance boost and dynamic page interactions by just dropping in a…
Toast notifications are a great way to give the user ephemeral, unobtrusive feedback about an action they have just carried out. Twitter uses them in response…
As I covered in my last post, Bridgetown is a new static site generator that’s been forked from Jekyll. It includes Webpack as a first class citizen so it’s all set up to allow developers…
Static HTML websites are incredibly popular these days. They’re unparalleled in performance as you can serve them via CDNs which are blazing fast. Also they’re incredibly easy to deploy…
Software product design these days is becoming more and more driven by metrics. A side effect of that is products are becoming largely homogenous. The recent release of Fleet by Twitter is a case in point. Companies are focused…
Cookies are used in pretty much every modern web application. They’re used for various purposes such as facilitating user authentication and storing user preferences. Since they’re so widely used…
There are a lot of good reasons to roll your own authentication rather than use something off the shelf like Devise. This comes with its own pitfalls and a rather easy mistake to make is to leave a vulnerability for session replay attacks…