...HTML elements can automatically start playing when the autoplay attribute is set on them. Except for when they can not...

Webpack is the future. We're using it in our latest Rails applications. For tests, we want to compile assets...

When deploying a Rails application that is using Webpacker and Capistrano, there are a few configuration tweaks that optimize the...

Carrierwave includes some handy helper methods you can use to resize your images. Here is a quick summary of them...

web.archive.org

Rails 6.1 has a "strict loading" mode that forces the developer to preload any association they plan to use. Associations...

chrisboakes.com

Debouncing a method call delays its execution until after a specified time has passed. If it's called again before...

github.com

Zeitwerk is the new autoloader of Rails. It is mandatory starting with Rails 7.0. Sometimes, a model needs to know...

When a controller action redirects to an external URL (like http://somehost.com/some/path) you will find that this is hard...

The tree command will show you the contents of a directory and all its sub directories as a tree:

makandra dev

...is no longer established using sudo per default. Databases created for local development usually belong to the local user an therefore do not need to be accessed using sudo...

track down warnings and to see failing specs immediately or to get an overview of the core...

...issue with this pattern/approach. What's happening? Consider these classes: class Post < ActiveRecord::Base belongs_to :thread def thread_title thread.title end end class Thread < ActiveRecord::Base has_many :posts...

...post.thread is not actually a Thread even though looking at its class makes you believe so: post.thread.class => Thread Its real class is ActiveRecord::Associations::BelongsToAssociation which is sometimes exposed, for...

...being used by default (which may be annoying). Here is how to do that. Beware: By following the steps below, you will drop and recreate your cluster. You will lose...

...As an example, we will be modifying 9.5 main (running on port 5435) below. Become a PostgreSQL superuser sudo su postgres Backup entire database pg_dumpall -p 5435 > 5435.sql

When such a virtual attribute should contain integer values you might get unexpected behavior with forms, because every param is a string and you don't get the magic...

When you write a custom RSpec matcher a good place to store them is to create one file per matcher...

...guest from the CD, open a terminal (on the guest, not the host!) and become root: sudo su fdisk -l to see the disk information. \ There should be one drive...

This note describes how to kick a user out of a Rails application after she hasn't requested an action...

PostgreSQL and ActiveRecord have a good support for storing dynamic attributes (hashes) in columns of type JSONB. But sometimes you...

tl;dr: Use event.currentTarget unless you are absolutely certain that you need event.target. Since it hasn't been written down...

Ruby methods which load from a Yaml file, like YAML.safe_load or YAML.safe_load_file, support passing freeze: true to...

With this command you can run all the spec files which have been edited or added in the current branch...

Ubuntu has a package mysql-sandbox that lets you install multiple MySQL versions into your user home: Install mysql-sandbox...

Rails has the handy controller method send_file which lets us download files easily. We can decide whether the file...

selenium.dev

...Chrome for Testing if none is found on the system. I worked around this behavior by setting the path to the binary in the selenium initializer Capybara.register_driver :selenium do...