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

When your Rails application offers downloading a bunch of files as ZIP archive, you basically have two options:

postgresql.org

TL;DR PostgreSQL handles Rails 4+ text and string columns the same. Some libraries may still reflect on the column...

...often show or hide elements based on viewport dimensions, or may have components that behave differently (like mobile vs desktop navigation menus). Since you want your integration tests to behave...

...metrics". This allows you to configure dimensions larger than your display and enable/disable touch behavior. Simply use register_driver to set up a driver that you then connect to Capybara...

When giving a presentation where you do some coding, the font size you usually use is probably a bit too...

github.com

When internationalizing your Rails app, you'll be replacing strings like 'Please enter your name' with t('.name_prompt'). You...

Authentication is hard: there are many edge cases, and most users (including yourself) usually only go the "happy path" once...

When HTTP clients make an request they can define which response formats they can process. They do it by adding...

When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...

This card explains how to generate an entity relationship diagram for your Rails application. We also show how to limit...

In the discussion of the difference between include and extend in Ruby, there is a misconception that extend would add...

stackoverflow.com

This card will show you how to use git rebase --onto without confusion. Use case: You've got two feature...

...Rails has a method ActiveRecord::Relation#merge that can merge ActiveRecord scopes. However, its behavior has never been clear, and in Rails 7 it still discards conditions on the same...

...column by the last condition. We discourage using #merge!) The best way to merge ActiveRecord scopes is using a subquery: scope_a.where(id: scope_b) It is a little less concise...

When you want to group rails models of a logical context, namespaces are your friend. However, if you have a...

github.com

...find(..., visible: true) or find(..., visible: :visible). Note that you could change the default behavior by setting the ignore_hidden_elements config option. However, ignoring invisible elements is a useful...

before(:all) runs the block once before all of the examples. before(:each) runs the block once before each...

This Capistrano task runs a command on all servers. bundle exec cap production app:run cmd='zgrep -P "..." RAILS_ROOT/log/production.log...

thoughtbot.com

While both the alt attribute and the figcaption element provide a way to describe images, the way we write for...

makandra dev

A lesser known fact about PG enums is that they are ordered. This can be really handy when values have...

I recently built a screen with a very high and wide table in the center. This posed some challenges:

island94.org

Rails 5.2 soft-deprecated the storage of secrets in secrets.yml in favor of a new thing, credentials.yml.enc. Rails 7.1 deprecated...

makandracards.com

So you're hunting down a regression (or just a bug) and want to use git bisect to find out...

This card describes different flavors for concatting HTML safe strings in a helper method in Rails. You might want to...

Sometimes it is useful to define a named scope by implementing a static method with the scope's name on...