Andrei Maxim

Andrei Maxim

July 2, 2024

Setting Up Postgres for Rails

If you are setting up a Rails application for development, and you need to run Postgres locally, you have two options: Install Postgres using the operating system package manager (e.g. apt get) Start a PostgreSQL container Installing locally is fairly trivial and involves just two commands: $ sudo apt install...

June 2, 2024

The Responsible Web Developer

One of the arguments for building web front-ends using tools like React is the ability to provide a better user experience. Nowadays, if you follow the advice of “tech influencers,” it’s a fool’s errand to build a web application without a very rich client layer, a backend split into discrete...

May 2, 2024

In Relentless Pursuit of RESTful Webhooks

I’ve recently seen a code sample about working with Stripe webhooks in Rails applications and I’ve noticed the following code in the controller: class StripeController < ApplicationController skip_before_action :verify_authenticity_token, only: [ :webhook ] def webhook # Sample code for handling Stripe webhook events end end First of all, I want...

April 17, 2024

Instance Variable Access in Ruby

Instance variables (or instance attributes) in Ruby are prefixed with an @ sign: class Person def initialize(salutation: nil, first_name:, last_name:) @salutation = salutation @first_name = first_name @last_name = last_name end def name [ @salutation, @first_name, @last_name ].compact.join(" ") end end john = Person.new first_name: "John", last_name: "Doe" john.name # =>...