Quantcast
Channel: Notes to self
Browsing index pages (53 articles)
↧

devise-otp 2.0 released

The OTP plugin for Devise I help to maintain goes 2.0 this week. Here is what’s new and how to upgrade.What’s newWe tried to address a couple of things in this release, mainly support for lockable...

View Article


InvoicePrinter 2.5 with QR images and Ruby 3.4 support

Today I released a new version of InvoicePrinter, my Ruby library for generating PDF invoices. Here’s what’s new.New featuresI finally implemented last feature I had in mind, QR code images. I decided...

View Article


Running JavaScript after a Turbo Stream renders

Turbo comes with turbo:before-stream-render but unfortunately doesn’t ship with the equivalent turbo:after-stream-render. Here’s how to run JavaScript after the stream renders.Why we need thisIf you...

View Article

Running interactive sessions with Kamal

How to connect to a container on a server managed by Kamal and run an interactive session?Interactive server actionsKamal comes with a kamal server exec to execute a single command on the server. If we...

View Article

Predownloading embedding models in Rails with Kamal

If you are building AI-powered applications in Ruby on Rails, you might have come across Informers or Transformers.rb gems for transformer inference. Here’s how to improve the production deployment of...

View Article


Combining multiple sitemaps with a sitemap index

What if we need to combine multiple sitemaps for a main domain or subdomain? Here’s how to do it by creating sitemap index.Sitemap indexLet’s say our site has a regular sitemap.xml and a...

View Article

Setting up Cloudflare R2 buckets for Active Storage

Rails comes with a built-in support for saving and uploading files to S3 and S3-compatible storage services in Active Storage. Here’s how to set up Cloudflare R2.Cloudflare R2To start using Cloudflare...

View Article

Image may be NSFW.
Clik here to view.

Adding button loader to Turbo-powered forms

Turbo is a great way to build user interfaces, but most Turbo forms have to wait for the server response. Here’s how I am adding a small loading spinner to the submit buttons to improve the UX.Submit...

View Article


Auto-saving Rails forms with Turbo Streams

Here’s how to implement autosaving for inline input fields the Hotwire way.Autosaved formsWhat’s autosave? Autosaving is saving a user input automatically on changes, lost focus or after an interval of...

View Article


Business Class 2.0 with Rails 8, Pay 8, Solid, Kamal 2, and fancy generator

The Ruby on Rails template Business Class gets a whole new edition. Rails 8, new licencing, and improved CRUD generator.Business Class 2.0The new Business Class is built on top of Rails 8, Pay 8, Solid...

View Article

Extending Rails authentication generator with registration flow

Rails 8 comes with a built-in authentication generator. However, it doesn’t yet come with registrations. Here’s how to add them.Rails auth generatorTo generate authentication scaffold, run:$ rails...

View Article

Cannot connect to the Docker daemon after switching to OrbStack

Switching from Docker Desktop to OrbStack and stuck at Docker daemon error? Here’s how to fix itWhen Kamal cannot connect$ kamal build ERROR: Cannot connect to the Docker daemon at...

View Article

How to use a remote build server with Kamal

How and when to create an external build server for your Kamal deploys?Remote build serverWhat’s a remote builder anyways? Kamal will build your Docker images locally by default (on your laptop or...

View Article


How does Kamal deploy to multiple hosts

How does Kamal deploy to multiple hosts at once? And how to configure it?SSHKitKamal is built around SSHKit which provides Kamal with the SSH connections to issue remote commands. Through out the Kamal...

View Article

Image may be NSFW.
Clik here to view.

Test Driving Rails, 1st edition is released!

I am releasing my third book today. This time about Rails-native testing!IdeaI am a big fan of Rails defaults and especially those for testing. Minitest and fixtures rock! But all I ever see are posts...

View Article


Using non-root users in Kamal

Kamal gives us an option to connect with a non-root user, but how can we create it?Creating a non-root userIf you use cloud VM providers like Hetzner or Digital Ocean, your virtual private server with...

View Article

Subclassing STI models in Rails

Here’s a short tip on opting out a specific model from Single Table Inheritance (STI).Imagine a Vehicle model which is implemented using STI and extented with a type parameter to Sedan and Wagon...

View Article


Show all running apps on the server with Kamal

Kamal 2 can deploy multiple apps on a single server so it’s easy to lose track of what’s deployed. This alias will fix it.To see all running apps on a server we need to query Kamal Proxy:$ ssh...

View Article

Understanding Kamal proxy roles

Kamal’s configuration comes with one primary proxy role to accept HTTP traffic. Here’s how to think about proxy roles and how to configure others.Kamal rolesRoles are a Kamal way to split application...

View Article

A closer look at Rails force_ssl and assume_ssl

Rails comes with a built-in support for SSL in form of config.force_ssl. But what does it exactly do?SSL middlewareThe force_ssl directive adds the ActionDispatch::SSL middleware layer which is a Rack...

View Article
Browsing index pages (53 articles)


Latest Images