ActiveRecord::Relation#merge overwrites existing conditions on the same column

Posted 10 months ago by Henning Koch.

In Ruby on Rails ActiveRecord::Relation#merge overwrites existing conditions on the same column. This may cause the relation to...

How to create a multiline map in SASS/SCSS

Posted 11 months ago by Max E..

If you want to to create maps within SASS/SCSS-files, it normally works like this: $some-map: (key1: value1, key2: value2...

Breaking changes for boolean attributes in HAML 6

Posted 11 months ago by Emanuel.

Haml 6 has some breaking changes regarding boolean attributes. Only the following attributes and aria/data attributes are considered boolean attributes...

Using Capybara finder methods with arbitrary matching conditions

Posted 11 months ago by Henning Koch.

Capybara has a variety of finder methods like find_button to help you look up DOM elements. There are also...

How to exclusively lock file access in ruby

Posted 12 months ago by Felix Eschey.
ruby-doc.org

We will achieve this by creating a block accepting method to optionally create and then lock a .lock File of...

How to enable template coverage support for simplecov

Posted Almost 1 year ago by Felix Eschey.
github.com

Since Ruby 3.2.0 you can measure coverage support for eval statements and support has been added for the simplecov gem...

Heads up: Deployment with newly generated SSH key (using ED25519) might fail

Posted About 1 year ago by Fabian Schwarz.

If you use a newer SSH key generated with the ED25519 algorithm instead of RSA (see Create a new SSH...

Story Checklist Template

Posted About 1 year ago by Felix Eschey.

This is an story checklist I use to work on stories. For this purpose I extracted several cards related to...

HTTP headers can only transport US-ASCII characters safely

Posted About 1 year ago by Henning Koch.

HTTP header values must only contain low-ASCII (7-bit) characters for safe transport. From RFC 7230: Historically, HTTP has...

git: find the version of a gem that releases a certain commit

Posted About 1 year ago by Daniel Straßner.

Sometimes I ran across a GitHub merge request of a gem where it was not completely obvious in which version...

Dynamic super-overridable methods in Ruby – The Pug Automatic

Posted About 1 year ago by Henning Koch.
thepugautomatic.com

How a macro can dynamically define a method that can be overridden with super in the same class.

Signed URLs with Ruby on Rails

Posted About 1 year ago by Henning Koch.
kukicola.io

Using ActiveRecord's #signed_id and .find_signed methods you can create URLs that expire after some time. No conditionals...

Why Sidekiq Jobs should never be enqueued in an `after_create` or `after_save` callback

Posted About 1 year ago by Tanja.

When an object is created / updated, various callbacks are executed in this order: before_validation after_validation before_save

Bundler 2.3 honors the version specified in `BUNDLED_WITH`

Posted About 1 year ago by Klaus Weidinger.
bundler.io

Bundler so far ignored the version specified under BUNDLED_WITH in the Gemfile.lock. This had two annoying consequences:

Ruby object equality

Posted About 1 year ago by Daniel Straßner.
ruby-doc.org

TLDR if you define a equality method for a class you must also implement def hash. Ruby has a lot...

Git: Restore

Posted Over 1 year ago by Julian.

tl;dr git checkout is the swiss army of git commands. If you prefer a semantically more meaningful command for...

RubyMine: Find and Replace with Regex (Capture Groups and Backreferences)

Posted Over 1 year ago by Julian.

tl;dr In RubyMine you can use find and replace with capture groups (.*?) and backreferences $1 (if you have several...

Prefer using Dir.mktmpdir when dealing with temporary directories in Ruby

Posted Over 1 year ago by Emanuel.

Ruby's standard library includes a class for creating temporary directories. Similar to Tempfile it creates a unique directory name...

Ruby and Rails: Debugging a Memory Leak

Posted Over 1 year ago by Dominik Schöler.

A memory leak is an unintentional, uncontrolled, and unending increase in memory usage. No matter how small, eventually, a leak...

Converting SVG to other vector formats without Inkscape

Posted Over 1 year ago by Arne Hartherz.

If you need to convert an SVG source to PS or EPS, the most common suggestion on the interwebs is...

Creating a Rails application in a single file

Posted Over 1 year ago by Arne Hartherz.
greg.molnar.io

Greg Molnar has written a neat article about creating a single-file Rails app. This is not meant for production...

A short overview of common design patterns implemented within Rails

Posted Over 1 year ago by Emanuel.
paweldabrowski.com

The linked content includes a few design patterns implemented with Ruby on Rails. What is the card indented to achieve...

makandra tech survey - results

Posted Over 1 year ago by Tobias Kraze.

These are the results of the "personal tech stack survey". I've included only the most popular mentions, maybe it...

Double loading issue with Ruby default gems

Posted Almost 2 years ago by Emanuel.

Ruby includes many standard gems that are bundled into the Ruby installation. Here is an example for the gem strscan...