How to: Use git bisect to find bugs and regressions
Binary search through commits isolates the first bad revision that introduced a bug or regression, with git bisect and optional automated tests.
better rails app restart with the passenger restart-app tool
passenger-config restart-app restarts a Rails app immediately without touching tmp/restart.txt, avoiding the next-request delay and fitting Capistrano deployments.
How to: Benchmark an Active Record query with a Ruby script
Benchmarking Active Record queries needs repeated runs and cache clearing to measure realistic PostgreSQL performance; a Ruby script can report percentile timings.
Making minimal updates to DOM trees using morphdom / idiomorph
Replacing DOM fragments with innerHTML wipes state such as form values, scroll position, and custom-element data. morphdom and idiomorph preserve existing nodes by applying minimal changes.
Fixing authentication in legacy applications
Legacy authentication setups often miss SSL, cookie, CSRF, and session-fixation protections, leaving logins and browser-stored data easy to compromise.
How to enable pretty IRB inspection for your Ruby class
Custom Ruby objects can gain colored, multiline IRB output by defining pretty_print; pretty_inspect is a simpler fallback when pretty printing is not needed.
How the Date Header Affects Cookie Expiration and Caching
Cookie expiry and HTTP cache lifetimes depend on the Date header when present; missing it can make mocked-time tests and browser caching behave inconsistently.
has_one association may silently drop associated record when it is invalid
has_one autosave can drop an invalid associated record without failing the parent save, leaving the parent persisted and the child unsaved.
PSA: Chrome and Firefox do not always clear session cookies on exit
Chrome and Firefox can retain session cookies on exit when reopening tabs from the last session, so browser shutdown does not always end cookie lifetime.
JSON APIs: Default design for common features
JSON API design benefits from established conventions for attributes, pagination, errors, and related objects, making client integration more predictable.
Rails: Configure ActionController to raise when strong params are invalid
Raise controller errors for unexpected request parameters in Rails APIs, letting invalid payloads surface as ActionController::UnpermittedParameters and ActionController::ParameterMissing.
Enabling view rendering for controller specs
Controller specs usually skip template rendering; integrate_views in RSpec 1 or render_views in RSpec 2 enables view rendering for specs that need it.
Choosing the right gems for your project
External libraries add maintenance and security risk, so picking a Ruby gem needs attention to necessity, test quality, license, maturity, and scope fit.
Capistrano 3: Running a command on all servers
Capistrano 3 can execute an arbitrary shell command across all app servers, useful for grepping logs or bulk remote checks.
How to tell ActiveRecord how to preload associations (either JOINs or separate queries)
ActiveRecord association loading can use separate queries or joins, and includes may switch between them automatically. preload is the safest default for avoiding surprise eager loading behavior.
Using a virtual column for trigram indexes in PostgreSQL
Trigram indexes provide a lightweight alternative when full-text search becomes too rigid or slow. A virtual column can combine multiple text fields and support indexed LIKE queries.
How to find out which type of Spec you are
Runtime checks can identify the current RSpec spec type, letting shared setup run only for controller, helper, or request/response-aware examples.
Don't require files in random order
File loading order from Dir.glob can vary by file system and break code that depends on load sequence. Sorting the matched paths or using sort: false in Ruby 3 makes it predictable.
Rspec: around(:all) and around(:each) hook execution order
RSpec hook order matters when around(:all) and around(:each) wrap setup and teardown; their execution timing differs from before and after hooks.
Cucumber: Identifying slow steps that drag down your test speed
Cucumber test suites can hide slow steps that waste most runtime. --format usage measures step durations and highlights optimization candidates, especially when waiting assertions surface previous delays.
Capistrano: Speeding up asset compile during deploy
Reducing Capistrano deploy time by persisting asset compiler caches across releases can skip repeated Sprockets or Webpacker work. esbuild has no comparable cache directory.
Generating and streaming ZIP archives on the fly
Large ZIP downloads can start immediately without writing files to disk, using zip_tricks_stream for custom content or zipline for existing attachments.
Why has_many :through associations can return the same record multiple times
has_many :through can return duplicate records when multiple join rows point to the same target; :uniq or DISTINCT removes repeated results.
Rails Asset Pipeline: Building an Icon Font from SVG Files
Asset pipeline setups can still build an icon font from SVG files, but the workflow needs manual generation and stylesheet integration.