Your after_commit callbacks will not know about changes, as Rails discards them when committing. The linked article shows a...
Sometimes you need to run background jobs that you can't make important guarantees about - they may run out of...
Large projects usually have large test suites that can run for a long time. This can be annoying as running...
In most of our applications, users have their first and last name stored in separate columns. However, specifying them separately...
When using ORDER BY "column" in PostgreSQL, NULL values will come last. When using ORDER BY "column" DESC, NULLs will...
When working with ActiveType you will often find it useful to cast an ActiveRecord instance to its extended ActiveType::Record...
Note: ActiveRecord::Base#becomes has a lot of quirks and inconsistent behavior. You probably want to use ActiveType.cast instead.
Starting from 4.1, Rails automatically detects the inverse of an association, based on heuristics. Unfortunately, it does not seem to...
There is no such thing as a "default order" of rows in database tables. For instance, when you paginate a...
ActiveModel supplies an errors object that behaves similar to a Hash. It can be used to add errors to a...
When you register a delegated event using on (or the deprecated delegate / live), it is somewhat hard to manually trigger...
Capistrano 3 is a major rework of the framework and requires several adjustments to your deploy configuration files. The biggest...
FactoryBot.define do factory :parent do transient do child_name nil child_allowed_to_drive false end child do association(:child...
When you have an element you want to hide, you can add a ng-show='isOpen' attribute to that element...
If you're a frequent user of LibreOffice, I strongly recommend to checkout out the VLOOKUP function (SVERWEIS in German...
Jasmine has a jasmine.clock() helper that you can use to travel through time and trigger setTimeout and setInterval callbacks:
Re-creating a complex ActiveRecord scenario quickly without setting up a full-blown Rails app can come in handy e.g...
When you want to UPDATE a table with information from an associated table, you can JOIN the associated table into...
Several Rails migration methods accept index: true as an option to create an index. In some cases (like #add_column...
jquery-placeholder is a simple jQuery plugin that enables form placeholders in browsers that do not support them natively, i.e...
You can freeze any Ruby object to prevent further modification. If you freeze an ActiveRecord and try to set an...
# Given the following models class Image < ActiveRecord::Base has_many :album_images has_many :albums, through: :album_images
When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc.
You know that ActiveRecord caches associations so they are not loaded twice for the same object. You also know that...