Articles, tips and guides about modern Ruby on Rails development.
Using the OpenAI Text-to-speech API with Rails
Learn how to create audio versions of your blogposts with the new OpenAI TTS API. We’re going to use Callbacks, ActiveJob and the ruby-openai gem.
Deploy a website with kamal-skiff
Using GitHub Container Registry, kamal-skiff, Hetzner and Cloudflare to deploy a simple static website
OpenAI transcription API and ActiveStorage analyzers
Connecting the OpenAI transcription API and ActiveStorage analyzers to transcribe audiofiles with AI
A demo of Rails and the OpenAI Chat API
Using the OpenAI Chat API, Server-Sent Events and Rails to generate blogposts automatically
Generated columns with ActiveRecord
I looked at the recent changes of Rails and Activerecord and spotted an interesting entry: Support for generated columns in PostgreSQL. In this post I’ll show an example how to use generated columns with Rails 7 and PostgreSQL. Let’s create a new table Humans with the stored generated column bmi_stored: class CreateHumans < ActiveRecord::Migration[7.0] def change create_table :humans do |t| t.integer :weight_in_kilos t.integer :height_in_cm # Generated columns bmi_sql_function = 'weight_in_kilos / (height_in_cm::float / 100) ^ 2' t....