developer.mozilla.org

Here is a workaround for when you want to use text-wrap: balance but must also render nicely for browsers...

DirectUpload allows you to upload files to your file storage without having to wait for the form to submit. It...

ActiveStorage does not provide any built-in way of implementing authentication for the available DirectUpload endpoint in Rails. When using...

SVG files often contain redundant information, like editor metadata or hidden elements. When esbuild handles your static assets, you can...

PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or...

There are several ways to run a single spec. I usually copy the spec file path with the line number...

The key to unlocking the full potential of LLMs in coding lies in crafting precise prompts. The main challenge is...

In Slack, the settings dialog only offers a fixed selection of fonts. You can use any font you like using...

Rails wraps your parameters into an interface called StrongParameters. In most cases, your form submits your data in a nested...

github.com

The new params.expect method in Rails 8 improves parameter filtering, addressing issues with malformed input and enhancing security. It provides...

makandra dev

Bundler allows you to specify the name of the Gemfile you want to bundle with the BUNDLE_GEMFILE environment variable...

To reverse lookup a fixture by its table name and id, use the following approach on ActiveRecord::FixtureSet: table = 'users...

TL;DR: Rails ships two methods to convert strings to constants, constantize and safe_constantize. Neither is safe for untrusted...

In development, we store files using ActiveStorage's disk service. This means that stored files are served by your Rails...

tl;dr When a cookie includes an Expires attribute or an HTTP response includes caching headers like Expires or Cache...

In FactoryBot factories, Rails' file_fixture is not available by default. To enable it, include a support module from rspec...

evilmartians.com

Some key highlights and points from the linked article TestProf II: Factory therapy for your Ruby tests. The Problem with...

developer.mozilla.org

Text fragments allow linking directly to a specific portion of text in a web document, without requiring the author to...

When Ruby objects are inspected in any modern IRB, some objects (like ActiveRecord instances) are rendered with neat colors and...

github.com

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

Rails 7.1 added the normalizes method which can be used to normalize user input. It lets you define the fields...

masilotti.com

Slow test suites are a major pain point in projects, often due to RSpec and FactoryBot. Although minitest and fixtures...

While the main goal always is to prevent long-running queries in the first place, automatic timeouts can serve as...

github.com

When handling nested hashes the RSpec output is often hard to read. Here the gem super_diff could help.