Rails Active Support provides some helpful methods for calculating times and dates, like Duration#ago or Duration#from...
Rails offers the fresh_when method to automatically compute an ETag from the given record, array of records or scope...
By activating strict_loading you force developers to address n+1 queries by preloading all associations used in the index...
Testing your responses in Rails allows to parse the body depending on the response MIME type with parsed_body.
We will achieve this by creating a block accepting method to optionally create and then lock a .lock File of...
The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...
Rails partials have a lot of "hidden" features and this card describes some non-obvious usages of Rails Partials.
In the past we validate and set default values for boolean attributes in Rails and not the database itself.
Not all email clients support external images in all situations, e.g. an image within a link. In some cases, a...
Since Rails 7 you are able to encrypt database information with Active Record. Using Active Record Encryption will store an...
Sometimes I ran across a GitHub merge request of a gem where it was not completely obvious in which version...
In Rails 5+ you can access a helper from a controller using the helpers method: # Inside a controller action
To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...
A severe bug was found in ImageMagick by Bryan Gonzalez from Ocelot Team. It allows to embed the content of...
Rails includes milliseconds in Time / DateTime objects when rendering them as JSON: JSON.parse(User.last.to_json)['created_at'] #=> "2001-01-01...
Sometimes, the rails dev server doesn't terminate properly. This can for example happen when the dev server runs in...
After upgrading to Rails 6.1.7.2 one of our apps printed a wall of warnings while booting: /var/www/app/shared/bundle/ruby/2.6.0/gems/net-protocol-0.2.1/lib/net/protocol.rb:68: warning: already...
Mit SQL spricht man mit relationalen Datenbanken. Ziele Verstehe die folgenden SQL Befehle SELECT WHERE ORDER INNER JOIN, LEFT JOIN...
Using ActiveRecord's #signed_id and .find_signed methods you can create URLs that expire after some time. No conditionals...
When an object is created / updated, various callbacks are executed in this order: before_validation after_validation before_save
Bundler so far ignored the version specified under BUNDLED_WITH in the Gemfile.lock. This had two annoying consequences:
Our CI setup frequently sees this error while running yarn install: yarn install v1.22.19 [1/4] Resolving packages... [2/4] Fetching packages...
In a Jasmine spec you want to spy on a function that is imported by the code under test. This...
When changing the glibc version, it's possible that the upgrade also includes changes to how locales work.