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:
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:
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).