Josh McArthur: Fancy Postgres indexes with ActiveRecord

Posted Almost 2 years ago by Florian Leinsinger.
joshmcarthur.com

I recently wanted to add a model for address information but also wanted to add a unique index to those...

Debug file system access in a Rails application

Posted Almost 2 years ago by Tobias Kraze.

It might sometimes be useful to check whether your Rails application accesses the file system unnecessarily, for example if your...

Capybara: Most okayest helper to download and inspect files

Posted Almost 2 years ago by Henning Koch.

Testing file download links in an end-to-end test can be painful, especially with Selenium. The attached download_helpers.rb provides...

Use DatabaseCleaner with multiple test databases

Posted About 2 years ago by Dominic Beger.

There is a way to use multiple databases in Rails. You may have asked yourself how you're able to...

ActiveRecord: Query Attributes

Posted About 2 years ago by Julian.

tl;dr You can use attribute? as shorthanded version of attribute.present?, except for numeric attributes and associations. Technical Details

How to bind an event listener only once with Unpoly

Posted About 2 years ago by Johanna Schalk.

You can use Unpoly's up.on with a named listener function and immediately unbind this event listener with { once: true...

JavaScript: Working with Query Parameters

Posted About 2 years ago by Julian.

tl;dr: Use the URLSearchParams API to make your live easier if you want to get or manipulate query parameters...

Version 5 of the Ruby Redis gem removes Redis.current

Posted About 2 years ago by Arne Hartherz.

Redis.current will be removed without replacement in redis-rb 5.0. Version 4.6.0 adds deprecation warnings for Redis.current and Redis.current=: `Redis.current...

RSpec: You can super into parent "let" definitions

Posted About 2 years ago by Arne Hartherz.

RSpec's let allows you to super into "outside" definitions, in parent contexts. Example: describe '#save' do subject { described_class.new(attributes...

PostgreSQL: "WHERE NOT <column> = '<value>'" statements do not include NULL values

Posted About 2 years ago by Jakob Scholz.

Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...

Rails 6.1: where.not changes behaviour from NOR to NAND

Posted Over 2 years ago by Julian.

Since Rails 6.1, if we use where.not with multiple attributes, it applies logical NAND (NOT(A) OR NOT(B)) instead...

Nokogiri: How to parse large XML files with a SAX parser

Posted Over 2 years ago by Florian Leinsinger.
dev.to

In my case [...] the catalog is an XML that contains all kinds of possible products, categories and vendors and it...

Caching in Rails < 6.1 may down parts of your application when using public cache control

Posted Over 2 years ago by Dominic Beger.

Proxy caching is a good feature to serve your publicly visible application content faster and reduce load on your servers...

Spreewald 4.3.3 released

Posted Over 2 years ago by Dominic Beger.

Field error steps Spreewald's The...

...field should have an error and The...

...field should have the error...

...steps now...

The TCF 2.0 (Tranparency and Consent Framework) standard, and what you should know about it

Posted Over 2 years ago by Tobias Kraze.

The Interactive Advertising Bureau (IAB) is a European marketing association which has introduced a standard how advertising can be served...

Using feature flags to stabilize flaky E2E tests

Posted Over 2 years ago by Henning Koch.

A flaky test is a test that is often green, but sometimes red. It may only fail on some PCs...

RSpec: automatic creation of VCR cassettes

Posted Over 2 years ago by Klaus Weidinger.

This RailsCast demonstrated a very convenient method to activate VCR for a spec by simply tagging it with :vcr.

Event delegation (without jQuery)

Posted Over 2 years ago by Henning Koch.

Event delegation is a pattern where a container element has a single event listener that handles events for all descendants...

Capybara can find links and fields by their [aria-label]

Posted Over 2 years ago by Henning Koch.

Sometimes a link or input field has no visible label. E.g. a text field with a magnifying glass icon 🔎 and...

Git shortcut to fixup a recent commit

Posted Over 2 years ago by Judith Roth.

git --fixup is very handy to amend a change to a previous commit. You can then autosquash your commits with...

Rails: Removing the cucumber-rails warning when setting cache_classes to false without Spring enabled

Posted Over 2 years ago by Emanuel.

We are using Spring in our tests for sequential test execution but not for parallel test execution. And Rails requires...

You should probably load your JavaScript with <script defer>

Posted Over 2 years ago by Henning Koch.

It is generally discouraged to load your JavaScript by a tag in the : The reason is that a tag will pause the DOM parser until the script has loaded and executed. This will delay the browser's first contentful paint. A much better default is to load your scripts with a tag: A deferred script has many...

Using multiple MySQL versions on the same linux machine using docker

Posted Over 2 years ago by Daniel Straßner.

We had a card that described how to install multiple mysql versions using mysql-sandbox. Nowadays with the wide adoption...

NVM: How to automatically switch version when changing directories

Posted Almost 3 years ago by Arne Hartherz.

The Node Version Manager allows installing multiple NodeJS versions and switching between them. By default, it does not automatically switch...