rails
I’ve set up this site to deploy with Kamal. Hit a snag with HTTP headers not being correctly passed through somewhere between Nginx, Traefik and Puma, which I solved by upgrading to the Rails 7.1 release candidate and enabling config.assume_ssl.
Tags:
Added tags to this site for microposts, which should make tracking things a bit better. In the process discovered you can’t do polymorphic associations with has_and_belongs_to_many, which seems like a missing feature.
Tags:
Added Solid Cache to this site. Completely and utterly unnecessary, but this is my Rails playground 😁
Tags:
Added the new default /up healthcheck endpoint to this site, and removed the healthcheck from the Kamal config so it can default to using that.
Tags:
Added a helper script to a project that uses RSpec to replicate the default behaviour of Rails segregation of system tests and get faster feedback more easily.
Tags:
Was curious if Rails supports database-generated columns: turns out, yes, as of Rails 7:
create_table :users do |t| t.numeric :height_cm t.virtual :height_in, type: :numeric, as: 'height_cm / 2.54', stored: true end
Tags:
This looks like it might be helpful when debugging sometimes
Post.attributes_for_inspect = [:id, :title] Post.first.inspect #=> "#<Post id: 1, title: "Hello, World!">"
Tags:
Wrote one very small Redmine plugin (to copy some data to the clipboard in a particular format for export) and have just started another, much bigger one, to manage jobs (in terms of blocks of time sold to clients for budget management).
Tags:
Added a private section to this site to track my health and try and find some patterns in what causes my CFS flareups. Currently it's just some CRUD stuff, but I plan to build this out to have some pointlessly flashy graphs &c.
Tags:
Watched the Rails World talk on deploying Active Record Encryption at GitHub.
Tags:
Set up virus scanning on Active storage attachments with Clamby. Might be worth a quick blog post or PR to their docs as there were a couple of gotchas.
Tags:
Opened my first Rails PR (to add some documentation). Hopefully it gets merged.
Tags:
Discovered that Active Storage variants by default will strip the animation from any GIF.
The solution is to pass loader: { page: nil } to variant, and also to preprocess the image with a call to convert --coalesce.
The solution is to pass loader: { page: nil } to variant, and also to preprocess the image with a call to convert --coalesce.
Tags:
Watched Peter Zhu’s talk at Rails World 2023—should give this autotuner thing a play.
Tags:
Learned a few useful things from Chris Oliver's Rails World talk:
- ActionText Embeds allow for embedding Rails models in a Trix input - might play with that here.
- rails routes --unused
Tags:
Migrated this site from Sprockets to Propshaft (my asset stuff is so simple there was nothing to really report).