Rails logs are not flushed automatically (in Rake tasks)

Production Rake tasks can lose Rails log output because the logger buffers lines and does not flush on exit. Rails.logger.flush or a task wrapper writes pending entries to disk.

Monitor a Rake task with God

Background Rake jobs can be tracked by God when the task writes its PID to a file path God expects; the process can then be restarted if it stops.

You can use any RSpec matcher to match arguments of method calls

RSpec method expectations can match arguments with any matcher, not just anything or hash_including, making loose argument checks more expressive.

Don't call gsub on safe strings

Calling gsub on html_safe strings can break backreferences like $1 and leave matches unusable. html_safe strings need special handling after substitution.

Capybara can match elements outside of <body>

Capybara can match elements outside body, including head nodes and hidden links, which helps test metadata and feed autodiscovery.

Mute a skype chat

Stop notifications from a single Skype chat without leaving it, or narrow alerts to specific keywords using /alertsoff and /alertson.

Mailcatcher: An alternative to inaction_mailer

Local email capture for Rails development avoids lost test messages and lets sent mail be viewed in a browser via MailCatcher.

How to update a MySQL column with ascending numbers

Assigning ascending values to an existing MySQL column can preserve a custom sort order, such as newest rows first, using a session variable and ordered UPDATE.

How to change the order of nested forms being rendered (especially blank forms)

Blank nested forms usually render last; reordering the one-to-many association changes their position and can move the empty form to the top.

Defining to_json and avoiding errors

Custom to_json methods can raise ArgumentError when their signature does not accept the expected options or arguments. Forwarding received arguments keeps JSON encoding compatible.

How to grep recursively on Solaris

Recursive grep is unavailable on Solaris, so searching files across directories requires a workaround with find and grep.

Start Rails console or server with debugger

Enable the Ruby debugger in script/console or script/server to inspect methods and local variables during a Rails session.

Git: Change author of a commit

Git commits can be reassigned to a different author when correcting attribution or rewriting shared history, using --author, --amend, or interactive rebase.

Properly adding fields with default values to a model

Avoid database defaults for new model fields; set existing rows in a migration and define defaults in the model with flag or has_defaults.

Single step and slow motion for cucumber scenarios using @javascript selenium

Pause Cucumber browser-driven tests between steps for debugging or demos, with single-step input and slower playback for @javascript Selenium runs.

Open a MySQL shell using credentials from database.yml

Open a MySQL prompt without retyping database credentials by using dbconsole with the password flag, optionally for another Rails environment.

Install the Oniguruma gem

Ruby regular expression support may require the Oniguruma engine and its native libraries before gem install oniguruma succeeds.

How to use CSS3 gradients in Opera

Opera 11.10 adds -o-linear-gradient support for CSS3 backgrounds, including angles, multiple color stops, and other CSS color formats.

Use SSL for Amazon RDS / MySQL (and your Rails app)

Encrypted connections between Rails and Amazon RDS MySQL protect sensitive data in transit. mysql and database.yml can be configured to require SSL end to end.

Making the rails 3.1. asset pipeline and asset precompiling work in production mode

Rails 3.1 asset pipeline issues in production can break precompiling, fingerprinting, and stylesheet rendering when Haml, Sass, and Compass are involved.

Removing ANSI color codes from Rails logs

ANSI color codes in Rails logs clutter less and vim; stripping escape sequences with sed produces readable log output or a colorless file.

Usage of RSpec's raise_error

raise_error without an expected exception can pass for unrelated bugs, so matching a specific error class and message makes specs meaningful.

Test that a form field has an error with Cucumber and Capybara

Capybara and Cucumber can assert field validation errors by checking for .field_with_errors around a named form field.

Prevent the selenium webbrowser window from closing after a failed @javascript step

Failed @javascript Cucumber steps can close the Selenium browser before the page state is inspected. Keeping the window open on failure helps debug the created data.