Threads and processes in a Capybara/Selenium session
Capybara/Selenium tests involve a test process, a server thread and a browser process, so blocking, stale time, and uncommitted transactions can cause seemingly impossible failures.
Carrierwave: Using a nested directory structure for file system performance
Large CarrierWave stores can overload a single directory with too many entries, slowing navigation and filesystem operations. Splitting record IDs into nested folders keeps directories manageable.
Bulk-change multiple table rows in a migration
Multiple column changes in a migration can trigger repeated SQL and slow large tables; change_table can bundle them into one ALTER TABLE statement.
Render Sass stylesheets dynamically
Serve CSS at request time from Sass templates while keeping asset_path, imports, and injected theme colors available. Useful when styles need dynamic values without ERB preprocessing.
Upgrading from Capistrano 2 to 3
Capistrano 3 replaces the old DSL with Rake and SSHKit, changing task syntax, hooks, server settings, and file layout during migration from Capistrano 2.
PostgreSQL: How to show table sizes
Large PostgreSQL databases can hide tables that consume most disk space. pg_total_relation_size and pg_size_pretty help identify the biggest relations quickly.
Using RSpec stubs and mocks in Cucumber
Cucumber can use RSpec doubles instead of Mocha; loading the integration in env.rb keeps stubs and mocks available after other After hooks.
Fix „command failed: /usr/bin/wkhtmltopdf ...“ using PDFKit middleware
PDF generation via wkhtmltopdf can fail on Passenger when the wrong binary is used or routing errors trigger deadlocks. Pointing PDFKit to a working local executable avoids the command failure.
Geordi 1.3 released
Geordi 1.3 adds Cucumber support with @solo handling, Capistrano 2/3 deployment fixes, and updated Firefox setup for selenium testing.
Copy to clipboard without flash (clipboard.js)
Flash-free copy-to-clipboard handling with clipboard.js, including success and error callbacks, text selection feedback, and support for text fields or data attributes.
How to fix: "rake db:rollback" does not work
rake db:rollback can do nothing when the latest migrated version has no matching migration file, often after switching branches or deleting a migration.
Test redirects to an external URL with Cucumber/Capybara
External redirects are awkward to test with Cucumber and Capybara: Rack::Test ignores the host, while Selenium follows it. Controller specs or an observable redirect make the target URL verifiable.
Careful when writing to has_many :through associations
has_many :through associations can lose or duplicate records when written to, especially with nested forms and loaded associations. Treat them as read-only or build the join records directly.
How to inspect controller filter chains in specs
Inspecting callback chains in controller specs helps verify before- and after-action behavior, especially when tests need to confirm filter order or presence.
How to use Haml in your helpers
Rendering helper output with content_tag can get clumsy; Haml::Engine lets helper methods build HTML fragments more readably, with access to other helpers and locals.
Split an array into groups
Ruby arrays can be split into fixed-size groups or a chosen number of groups with ActiveSupport, padding or omitting leftovers as needed.
Postgres: How to force database sessions to terminate
PG::ObjectInUse blocks dropping or resetting a PostgreSQL database when other sessions stay connected. Find the backend PID and terminate the process when needed.
Linux Performance Analysis in 60,000 Milliseconds
A Linux server with a performance issue needs fast triage in the first minute. Core commands reveal load, memory, CPU, disk, network, and process bottlenecks.
Designing HTML emails
Email client rendering is inconsistent, so HTML messages need table-based layouts, inline styles, and client-specific workarounds to remain readable across major mail apps.
Stub a request's IP address in a Cucumber scenario
Force a fixed client IP in Cucumber scenarios when request-dependent code needs predictable behavior.
SSHKit 1.9.0 failure for Capistrano deploy
Capistrano deploys can crash in sshkit-1.9.0 with NoMethodError in pretty.rb; upgrading SSHKit to 1.21.0 resolves the failure.
MySQL: Do not use "WHERE id IN (SELECT ....)"
MySQL subquery filters in WHERE id IN (SELECT ...) can force repeated scans and hurt update performance; a JOIN or preloaded id list is faster.
IRB's multi-line autocomplete and how to disable it
IRB’s multi-line completion can slow down input and make Backspace unreliable; --nomultiline or IRB.conf[:USE_MULTILINE] = false disables it while keeping Tab completion.
Handy: A regex that validates all valid email addresses (give or take) - Axon Flux // A Ruby on Rails Blog
/^([\w!#$%&'*+-/=?^`{|}~]+.)*[\w!#$%&'*+-/=?^`{|}~]+@((((([a-z0-9]{1}[a-z0-9-]{0,62}[a-z0-9]{1})|[a-z]).)+[a-z]{2,6})|(\d{1,3}.){3}\d{1,3}(:\d{1,5})?)$/i