Rails: Encrypting your database information using Active Record Encryption
Rails 7 app data can be stored as encrypted attributes with deterministic lookup support, but search, grouping, and bulk updates become limited.
git: find the version of a gem that releases a certain commit
Find the gem version that first contains a commit by using git name-rev --tags; it points to the next release tag after the change.
Rails: Accessing helper methods from a controller
Controllers can call view helpers in Rails 5+ through helpers, while older Rails versions use view_context to reach methods like link_to.
Pattern: Disabling a certain feature in tests
Integration tests often break on cookie banners or captchas. A test-only switch disables them by default while allowing targeted reactivation for specific cases.
Lazy-loading images
Loading large page images only when they enter the viewport cuts bandwidth use and can improve perceived speed. Missing crawler support and layout shifts remain common issues.
Preconnect, Prefetch, Prerender ...
Early browser hints can reduce page load latency by preparing DNS lookups and connections before navigation.
RSpec: How to compare ISO 8601 time strings with milliseconds
Rails JSON serializes times with milliseconds, so iso8601 and to_json can differ in RSpec expectations. Using to_json keeps time string comparisons matching.
How to kill a Rails development server by force
A stuck Rails development server can keep port 3000 busy and trigger EADDRINUSE; lsof and kill -9 can force it down.
Consul 1.3.0 lets you override generated controller methods
Consul 1.3.0 allows overriding generated controller methods mapped with :as, while super preserves the original implementation for added scope conditions.
Fixing wall of net/protocol warnings
Rails boot warnings from duplicate net-protocol constants after upgrading can be silenced by avoiding automatic loading of net-http, net-imap, net-protocol, and net-smtp.
Why Sidekiq Jobs should never be enqueued in an `after_create` or `after_save` callback
Database transactions can roll back after after_save, leaving Sidekiq jobs queued for records that never persist. after_commit runs after persistence and avoids this race.
Heads up: expect(object).to receive(:method_name) does not execute the original implementation of the method
receive(:method_name) stubs the original method implementation, so callbacks or side effects do not run during expectations. and_call_original preserves the real behavior.
How to make your git aliases work with both master and main
Git aliases can break when default branches differ between repositories. Using init.defaultBranch lets shared aliases adapt to master or main.
Spreewald: patiently blocks must not change variables from the surrounding scope
patently blocks must keep local variables inside the block; rebinding an outer variable breaks retries because later attempts reuse the changed value.
Signed URLs with Ruby on Rails
Temporary, tamper-resistant links can be built in Rails without extra database columns or conditional logic by using ActiveRecord's signed_id and .find_signed.
Finding a method name on a Ruby object
Search an object's method list when you only know part of a name; grep and method-set subtraction help isolate relevant public or private methods.
RubyMine's clipboard can hold more than one string
RubyMine keeps a clipboard history, letting you paste earlier copied strings instead of only the most recent one.
Ruby: Natural sort strings with Umlauts and other funny characters
Ruby string sorting misorders German umlauts, mixed case, and embedded numbers. to_sort_atoms, natural_sort, and natural_sort_by provide natural ordering.
Bundler 2.3 honors the version specified in `BUNDLED_WITH`
Bundler 2.3 respects the BUNDLED_WITH version in Gemfile.lock, preventing silent lockfile changes and installing the required version automatically.
Fixing Yarn 1 error "unexpected end of file"
Yarn 1 can fail with "unexpected end of file" during yarn install when registry downloads disconnect; increasing the network timeout or retrying can work around it.
How to read the current breakpoint tier(s) in JavaScript
Read the active viewport size in JavaScript by exposing a CSS custom property from media queries and retrieving it with getComputedStyle for responsive behavior.
How to develop designs for an enterprise customer
Enterprise design work can be derailed by late executive rejection despite lower-level approval; early mood designs and top-level sign-off reduce costly rework.
Rails: Passing array values to tag helpers like link_to
Array values in Rails HTML options become space-separated strings, making class helpers accept multiple CSS classes without manual joining.
Don't mix Array#join and String#html_safe
Mixing safe and unsafe HTML strings with Array#join breaks Rails output safety and can trigger incorrect escaping or unsafe rendering.