How to fix strangely disappearing or misbehaving forms
Nested form elements can vanish or submit the wrong data because browsers handle invalid form markup inconsistently, especially during Ajax updates.
Cucumber: Detect if the current Capybara driver supports Javascript
Capybara.javascript_test? checks whether the current driver supports JavaScript, helping feature tests switch behavior for Selenium, capybara-webkit, Poltergeist, and custom drivers.
Different behavior for BigDecimal#floor in Ruby 1.8 and Ruby 1.9
BigDecimal#floor returns different types in Ruby 1.8 and 1.9 because it depends on Float#floor; a backport restores the Ruby 1.9 behavior on Ruby 1.8.
How to fix webpack-dev-server not found
bin/webpack-dev-server can fail with Yarn's "Command "webpack-dev-server" not found" error when dependencies are missing; yarn install --check-files restores the command.
Git error: "badTimezone: invalid author/committer line - bad time zone"
Malformed commit timestamps can make git clone fail with badTimezone when strict object validation is enabled. Disabling fetch.fsckobjects works around the error.
Why your previous developer was terrible
Judging legacy code by today’s needs hides the uncertainty faced during initial development, where many architecture and technology choices were made with incomplete information.
Recursively remove unnecessary executable-flags
Unexpected executable bits can appear on normal project files after copying from Windows or a Samba share. geordi remove-executable-flags clears them recursively with chmod -x.
Understand ActiveRecord::ReadOnlyRecord error
Records loaded with SQL fragments in :select or :joins become read-only in ActiveRecord to avoid saving rows with noncolumn attributes. :readonly => false overrides the safeguard.
How Exchange handles multipart/alternative emails
Exchange can discard the plaintext part of multipart/alternative email, leaving only HTML in normal mail accounts and complicating debugging.
Ruby: How to update all values of a Hash
Update every entry in a Ruby Hash with a concise merge! trick when each key needs a new computed value.
Unicorn: How to force a single threaded boot in development
Limit Unicorn to one worker in development to keep debugging output manageable and prevent concurrent requests like ActionCable from flooding the console.
Connecting to MSSQL with Ruby on Ubuntu - lambie.org
Connecting Ruby on Ubuntu to Microsoft SQL Server can require nonstandard drivers and native libraries, especially for older SQL Server versions on Linux.
Why your Cucumber feature loses cookies when run under Selenium
Cucumber/Selenium tests can lose cookies and sessions when the app and browser run in different times, because old dates make cookies expire immediately.
Debugging failed AJAX requests with better_errors
better_errors adds enhanced development error pages with a live REPL, and /__better_errors lets you inspect exceptions from AJAX requests.
ActiveRecord: When aggregating nested children, always exclude children marked for destruction
Nested form deletions can inflate aggregated totals when child records marked for removal are still counted. marked_for_destruction? filters them out before saving.
RSpec 2.6 supports "any_instance" now
any_instance stubbing and expectations now work in RSpec 2.6, enabling should_receive and stub on instances created inside code.
How to stub class constants in RSpec
RSpec cannot stub constants directly; using attributes, wrapper methods, or test helpers makes constant-dependent code easier to isolate.
Ruby: Find the most common string from an array
Find the most frequent string in an array without failing on empty input; the approach uses grouping and returns the first value from the largest group.
Whenever: Don't forget leading zeros for hours!
Whenever can misread 24-hour times without a leading zero, turning 3:00 into 3pm instead of 3am. chronic_options can switch parsing to a 24-hour clock.
A nicer way to run RSpec and/or Cucumber
Convenience scripts streamline RSpec and Cucumber runs with bundle exec, parallel execution, spinner support, and a full test check against regressions.
Random list of ActiveSupport goodies
Handy ActiveSupport helpers add callbacks, message signing and encryption, ordered options, array wrapping, deep hash merging, whitespace squishing, and zone-aware current time.
Aspect Oriented Programming in Ruby
Integrating cross-cutting concerns in Ruby can reduce duplication and keep logging, security, and other shared behavior separate from core business logic.
Live CSS / view reloading
Automatic browser refresh for stylesheet and view changes reduces manual reloads during front-end work and keeps page updates visible immediately.
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.