How &: Works in Ruby

Chances are you've seen and written code like users.map(&:first_name) in ruby or rails applications many times. If you're new to Ruby, you may have wondered about this strange syntax. Let's demysify &: and explain exactly how it works. First we start with blocks and how to…

What is Arel: Between ActiveRecord and SQL Queries

I recently learned that ActiveRecord uses Arel under the hood. What is Arel? When would it be useful in practice? let's find out! Motivation ActiveRecord is useful and its DSL allows us to write many queries with .find_by and .where. But it does have limitations in the types of…

Stimulus Rails 7 Tutorial

Hotwire (HTML-over-the-wire) ships by default in Rails 7. Stimulus is one component of Hotwire, the other one being Turbo. The key promise of the Hotwire approach is to get the benefits of single-page JavaScript applications like faster, more fluid user interfaces without writing much Javascript (certaintly not the amount needed…

Introduction to Hotwire and Turbo

The Rails 7 release in December 2021 officially shipped with Hotwire. Or more precisely with the turbo-rails and turbo-stimulus gems. Hotwire is an 'umbrella' term for the concept of sending Html-Over-The-wire but not a specific library. Although I started working with Ruby and Rails in 2012 when I transitioned doing…

Boron Letters: Advice on Copywriting - Part 7

Chapter 24 Getting customer's attention Reasons for stopping a habit, in this case of writing letters: he wants to review some reference material and take notes to have more coherent things to write he wants the son to type up the first 25 letters he is going to focus on…

Boron Letters: Advice on Copywriting - Part 6

Chapter 21 How to think about offering a product discount The author is feeling tired. Physically in terms not being able to complete his 'road work' in one go. And also mentally in terms of longing for freedom and feeling down in general. Yet the writing continues. [Lesson] The author…

Boron Letters: Advice on Copywriting - Part 5

Chapter 17 How to get good at copywriting The way to get good at copywriting is to copy good writing. [I knew there would be a pun in there] The author advices copying by hand good ads you come across. Before I decided to read these Boron Letters, I recall…

Boron Letters: Advice on Copywriting - Part 4

Chapter 13 Do guilt and manipulation work? This letter starts off explaining how to induce guilt in a direct mail sales pitch. Sadly, the below sample copy does not stand the test of time. So many fauxpas here. More an example of things you do not want to say in…