Upgrading Rails 2 from 2.3.8 through 2.3.18 to Rails LTS

Rails 2.3.x upgrades fix security vulnerabilities and API changes across patch levels, with extra CSRF, XSS, and JSON gem updates needed on some releases.

ActiveRecord.select

Selecting specific columns limits loaded attributes and can make records read only, while SQL expressions can add computed fields for sorting and display.

Help me, there is a zombie process!

Zombie processes appear when child processes exit but the parent never waits, leaving defunct entries in ps; fixing or restarting the parent removes them.

asciidisco/Backbone.Mutators · GitHub

Backbone plugin for custom getter and setter logic on model attributes, enabling computed values and validation without changing core model code.

Rails: Have different session secrets for all environments

Using the same Rails session secret in staging and production can let a cookie from one environment authenticate in another. Separate secrets per environment reduce session hijacking risk.

Rails: Send links in emails with the right protocol

ActionMailer defaults to http in email links, which can expose session cookies to SSL-stripping. Set default_url_options or the link protocol to use https where needed.

git: How to always pull with rebase

Keeping git branches linear avoids cluttered merge commits when pulling updates. Setting pull.rebase=true makes git pull rebase by default.

Pimp my IRB

Custom .irbrc files can make irb and the Rails console more useful with extra methods, nicer printing, editor integration, and app-specific prompts.

Virtus: Coercing boolean attributes

Virtus boolean attributes need Virtus::Attribute::Boolean rather than Boolean, because Ruby has no native Boolean class and Virtus will not coerce it correctly.

Bundle capistrano

Capistrano API changes can break deployments with older deploy.rb files; bundling it and using bundle exec helps keep releases working.

Ubuntu: Restart sound services

Broken speaker output on Ubuntu can often be restored by restarting the audio stack with pulseaudio -k and reloading ALSA.

marcandre/backports · GitHub

Backported Ruby 1.8.7–2.0.0 features for older Ruby versions improve compatibility and access to newer core APIs without upgrading the interpreter.

Subscribe to Rails security mailing list without Google account

Subscribe to the Ruby on Rails security mailing list without a Google account by using a direct boxsubscribe URL instead of the web interface.

Clean up application servers when deploying

Frequent deployments fill application servers with old releases, tmp files, and stale compiled assets. Capistrano can automate release and asset cleanup to prevent disk-space exhaustion.

How to remap keys in Ubuntu

Keyboard remapping in Ubuntu lets you change key behavior when layouts or hardware keys are inconvenient. xmodmap can adjust mappings using keycodes from xev.

Redactor WYSIWYG html editor

Lightweight WYSIWYG HTML editing for web apps, with a cleaner interface than TinyMCE or CKEditor and Rails integration.

Launch Gnome disk utility from command line

Launch the GNOME disk utility from the terminal with sudo palimpsest.

Ruby Scripts: Select the Ruby version in the shebang

Use rvm in a script shebang to run Ruby with a specific version instead of the system default.

News flash: Absolute CSS positioning on opposite sides is not a problem

Absolutely positioned boxes can use opposing offsets on both sides in modern browsers; only IE6 and older break this layout.

How to clear cookies in Capybara tests (both Selenium and Rack::Test)

Need to remove cookie data during a Capybara scenario when browser state must reset before the test ends.

How to: Build a "generic observer" widget for the awesome window manager

Periodic command output in an awesome panel can be turned into a widget with a timeout timer and escaped text.

LibreOffice Calc: Reset positions of split dividers

Split panes in LibreOffice Calc can end up in awkward positions; moving the dividers off screen and toggling splitting restores the default layout.

Inherit without Single-Table-Inheritance (STI) in ActiveRecord

ActiveRecord can inherit without STI when no type column exists or inheritance_column is overridden, making form models and presenters possible.