Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...

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

(Rails has a method ActiveRecord::Relation#merge that can merge ActiveRecord scopes. However, its behavior has never been clear, and...

While verifying doubles in RSpec is a good default, it is limited in the amount of methods it actually is...

Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...

Angular 1.3+ has an alternative getter/setter pattern: You can bind ng-model to an accessor function. This is a function...

makandra dev

Or: How to avoid and refactor spaghetti code Please note that I tried to keep the examples small. The effects...

To use a form model with devise, you can simply override #resource_class in a controller. A typical use case...

When your controller action raises an unhandled exception, Rails will look at the exception's class and choose an appropriate...

makandra dev

There are multiple ways to redirect URLs to a different URL in Rails, and they differ in small but important...

By activating strict_loading you force developers to address n+1 queries by preloading all associations used in the index...

When delivering non-public uploaded files (images, documents etc), one has to decide whether and how to do authorization. The...

Programatically invoke Rails generators Require the generator, instantiate it and invoke it (because generators are Thor::Groups, you need...

To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...

If you are using PDFKit / wkhtmltopdf, you might as well want to use custom fonts in your stylesheets. Usually this...

...can be set by the default rails app generator. Example %w( active_record/railtie action_controller/railtie action_view/railtie action_mailer/railtie action_mailbox/engine ).each do |railtie| require railtie

Simplecov is a code coverage tool. This helps you to find out which parts of your application are not tested...

When redirecting you should take care to use the right HTTP status code. From controllers When redirecting from a controller...

makandra dev
github.com

PDFKit converts a web page to a PDF document. It uses a Webkit engine under the hood...

If you are using the routing-filter gem in your Rails 7.1 app for managing URL segments for locales or...

The Basic Authentication header encodes username and password. Effectively, it's just Base64 plus a "Basic" prefix.

Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...

edgeapi.rubyonrails.org

Starting from Rails 4.0, you can use a special form options helper called #collection_check_boxes. It behaves similar to...

This is a personal post-mortem analysis of a project that was mainly build to provide a REST API to...