Mysql::Error: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1 (ActiveRecord::StatementInvalid)

Parallel test runs can trigger missing-savepoint rollback errors when processes share a database or transactional test settings conflict.

Simple form examples with bootstrap

Building Bootstrap forms with simple_form reduces repetitive markup and keeps form layouts consistent.

VCR and the webdrivers gem

VCR can complain when webdrivers checks the internet for driver updates during tests. Updating locally, ignoring the update host, or pinning the driver version avoids the noise.

Fix Rubygems binary error: undefined method `activate_bin_path' for Gem:Module (NoMethodError)

Rubygems version mismatches can break generated executables with undefined method activate_bin_path after downgrades. Reinstalling gem executables with gem pristine --all or reinstalling RubyGems and Bundler restores working binstubs.

Workaround for broken integer division after requiring the mathn library

mathn can silently replace integer division with exact rationals across a Ruby project. A workaround limits the monkey patch to code that explicitly needs exact division.

Saving application objects in your session will come back to haunt you

Storing application objects in sessions can trigger ActionController::SessionRestoreError after class removal or deployment. Keep session data to strings and numbers, or provide stubs for old classes.

How to drop all tables in PostgreSQL

Removing every table while keeping the PostgreSQL database can be done by dropping the schema or iterating through tables with DROP TABLE statements.

Subclassing module

Ruby module subclassing injects state and defines accessors when included, enabling trait-like macros and partial classes for cleaner model organization.

rsl/stringex ยท GitHub

Ruby string extensions for turning text into URL-friendly slugs, with Unicode handling and locale-aware replacements for symbols and HTML entities.

Ruby's default encodings can be unexpected

Plain Ruby strings can inherit inconsistent encodings from Encoding.default_external, causing incompatibility errors when text comes from StringIO, CSV, files, or IRB.

How to preview an image before uploading it

Live image previews in file upload forms improve user feedback before sending files to the server, using URL.createObjectURL with img tags or Unpoly compilers.

Middleman does not fingerprint asset paths by default

Middleman static sites serve stable asset URLs by default, so cached JavaScript and CSS can stay outdated. :asset_hash adds fingerprinted paths to force cache refreshes.

Ruby 2.3 new features

Ruby 2.3 adds safer nil handling, easier hash access, subset comparisons, numeric predicates, and negative filtering for cleaner collection code.

Unexpected behavior when changing both an association and its foreign key attribute in ActiveRecord

Changing an association and its foreign key on the same ActiveRecord object can lose the later assignment; the association value wins on save.

Measuring sql query time of a piece of code using ActiveSupport::Notifications

Measure database time for a Ruby code block by collecting sql.active_record events and summing their durations with ActiveSupport::Notifications.

Install a local Gemfile on a remote server

Run bundle install on a remote host using a local Gemfile, even for vendored gems or a different BUNDLE_GEMFILE.

How to encode or decode quoted-printable strings

Quoted-printable mail encoding turns characters like = into escape sequences and may wrap long lines. Ruby can decode and encode it with unpack('M') and pack('M').

Multi-line Ruby block in Haml

Haml can render multi-line Ruby code with the :ruby filter when puts sends generated output into the template response.

How to remove RSpec "old syntax" deprecation warnings

RSpec 3 deprecates :should expectations, causing warnings in older test suites and gems that need backward compatibility. RSpec.configure can re-enable both syntax styles.

Machinist's #make breaks on has_many associations when defining method `empty?`

Custom empty? on a has_many model can break Machinist collection building, creating records with the wrong foreign key. Use explicit association assignment instead.

MySQL 5.6 slightly changes DECIMAL data type

MySQL 5.6 changed DECIMAL storage and removed the old extra-digit behavior, so columns that relied on it may now need higher precision.

Mysterious "margin" below an image

Inline images can leave a small gap below them because they align to the text baseline, reserving space for descenders. vertical-align: middle or display: block removes the gap.

Why you see a GET "/__identify__" request in Capybara tests

Unexpected GET /__identify__ requests in Capybara test logs come from server readiness checks for Selenium-style drivers; Capybara answers them with middleware when no route exists.

PostgreSQL's OVERLAPS operator is not fully inclusive

PostgreSQL OVERLAPS treats date ranges as start <= time < end, so boundary dates are excluded and adjacent ranges do not match.