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...

...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...

It is possible to add custom http header to request made by the docker CLI client. This can be used...

stackoverflow.com

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

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...

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

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...

Maintain this feature branch on a regular basis to not get too far behind production. Setup a reminder to either merge the branch or drop it. Inform the colleagues...

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...

makandra dev

Geordi provides a pretty neat way to generate beautiful commit messages according to your stories in Linear: geordi commit Geordi reads from a .geordi.yml file inside your repo and connects...

If you need to pre-generate a scram-sha256 password hash for use with postgres, e.g. for using it with...

Most of our applications use CarrierWave for file uploads. CarrierWave has an integrated processing mechanism for different file versions with...

...write <<EOT. If you do this, your terminating sequence must be at the very beginning of the line. It's less pretty and there is rarely a reason to use...

haml.info

...nesting level of elements. When it comes to white-space preserving content, this may become a problem: the content will be rendered including the HTML indentation. Problematic: Preserved Indentation

%pre = content Reference Hello World Better: Without Extra Indentation Render with tilde ~ instead of equals = to keep Haml from indenting content: .nest %span Reference %pre ~ content Reference