How-To
Practical guides and quick tips for solving specific problems.
Rails 6, Webpacker, and the Cocoon gem
A straightforward way to use the Cocoon gem in your Rails 6 project, using Webpacker.
Rails 6, Webpacker, and jQuery
Quickly add jQuery to your Rails 6 application using Webpacker
Importing Heroku PostgreSQL to localhost
Importing a Heroku PostgreSQL database to your local machine, quickly and easily.
Easily Add An Instagram Feed To Jekyll
How to easily add an Instagram feed to your Jekyll site, while avoiding the gotchas.
Imagemagick On Heroku-16
I recently encountered some strange memory issues after upgrading to Heroku-16. I was a little surprised at what I found regarding Imagemagick on Heroku.
IE tries to be helpful when using JavaScript to set the href attribute
When using JavaScript to set the href attribute of an anchor tag, IE sometimes updates the inner HTML. Why does this happen and what are some solutions?
IE7 resize window problem
I describe a problem encountered in IE7 when dealing with a centered body and relatively positioned elements that appeared to have a fixed position.
Quick Tip: Rails Named Bind Variables
How to use named bind variables in a Ruby on Rails query to increase readability and reduce duplication.
Quick Tip: Cucumber Works-in-Progress
How to use the Cucumber tagging feature to tag scenarios.
Quick Tip: Rails Singularization of -ess
How to handle singularization of words like 'business' and 'address' through custom inflection rules in Ruby on Rails.
Fixing Multipart Uploads in Rack for Ruby 1.9
Patch your Rack installation after seeing an 'invalid byte sequence in US-ASCII' error.
Using Named Scopes in a Rails Plugin
After extracting common functionality with named scopes into a Rails plugin, I was seeing some strange behavior. I describe the cause and solution.
Quick Tip: Override Rails Generated URLs
Override the default Ruby on Rails generated URLs for a resource. It is a quick and simple way to change your URLs without changing your code.
Enable Secure Admin for Wordpress
Secure your Wordpress administration area using a self-signed certificate and Nginx webserver.
SEO Resources for Dummies (i.e., me)
My experiences with learning search engine optimization (SEO) to help the ranking of Millarian.
Monitoring Thin using God, with Google Apps Notifications
A complete God config for monitoring Thin processes with email alerts via Google Apps SMTP
Installing aspell and raspell for Ultrasphinx
Resolving Ultrasphinx spell-checking warnings by installing aspell and its Ruby interface
Error after upgrading SliceHost
Fixing the INLINEDIR/HOME TemplateError that appears after a SliceHost upgrade
Quick Tip: Setting an SPF record
Adding a DNS TXT record to stop Google Apps from rejecting your Rails app's outgoing email
Quick Tip: Rails 2.1 Time Zones
Setting your application time zone in Rails 2.1 with config.time_zone
Quick Tip: Setting time zone on Ubuntu Hardy
A one-command way to configure the time zone on your Ubuntu server
Nginx 405 Not Allowed Error
How page caching with nginx causes 405 errors on POST requests, and how to fix it
Quick Tip: named_scope
Building chainable, reusable query scopes in Rails 2.1 with named_scope
Quick Tip: SSH Backspace
Fixing the broken backspace key when using SSH from Mac Terminal
Quick Tip: Route Associations
Simplify nested resource routes with has_one and has_many shorthand options
Quick Tip: has_many :through => checkboxes
Using Rails' auto-generated *_ids= setter to manage many-to-many associations via checkboxes
Quick Tip: Capistrano SSH Ports
How to configure Capistrano to connect on a custom SSH port
Rails Class Collisions
Working around Rails generator errors when existing constants collide with generated class names
Quick Tip: SSH Config
Create short hostname aliases in ~/.ssh/config to simplify SSH connections
Caching Locale-specific Dynamic JavaScript Files
Using ERB-rendered JavaScript with per-locale page caching in Rails
Rails Tip: Precision and scale for decimals
How to specify precision and scale for decimal columns in Rails migrations using BigDecimal
Rails counter_cache problem
Why counter_cache only updates one parent when creating through an association, and how to fix it
Minor TextMate Annoyance
Customizing the TextMate do snippet to omit the block variable by default
The Tip of the Ruby #1
Understanding the difference between or and || operator precedence in Ruby
Search Engine Optimization for Coders
Notes from a Desert Code Camp talk on practical SEO tips for developers
Discover your missing specs
A rake task that finds app files without corresponding RSpec test files and generates them
Firefox Profiles
Using Firefox profiles to separate your development extensions from personal browsing
Rails Testing Tips: Testing a helper with a block
Two approaches to testing a Rails helper method that accepts a block using RSpec
Rails Testing Tips: Stubbing controller methods in a helper test
In RSpec helper tests, the controller context is self -- use self.stub! to mock controller methods
iBug
Firebug for the iPhone -- a small webserver that forwards log messages to the Firebug console
Userstamps
Automatically recording created_by and updated_by user IDs on ActiveRecord models
Migration Timestamps deleted_at Magic Field
Extending Rails migration timestamps to automatically include a deleted_at column for acts_as_paranoid
Tuning a Pack of Mongrels
How to benchmark and determine the right number of Mongrel instances for your Rails app
Exploring Mongrel... Finally
A getting-started guide to Mongrel and Mongrel Cluster for serving Ruby on Rails applications
Ruby on Rails Resources for Newbies
A curated list of books, screencasts, and subscriptions for learning Ruby on Rails
Google Maps API with large data sets
Exploring optimization techniques for displaying thousands of markers on a Google Map
Ruby Time Limitations
Ruby's Time class has platform-dependent minimum values -- use Date or DateTime instead
Firebug Intro
A video introduction to the Firebug Firefox add-on for debugging JavaScript, Ajax, and CSS
Rails Testing Tips: Login gotcha
A workaround for testing controllers that require admin login from a different controller
Rails Testing Tips: flash.now gotcha
How to test flash.now values that get cleared after rendering the view
Dissecting a Regular Expression
Breaking down a Ruby regex that extracts a file extension from filenames with spaces and multiple dots
Render Partial for Email Template
A workaround for rendering partials inside Rails mail templates using relative paths
Rails Sweetness
Using single-table inheritance in Rails to model different address types for users and businesses
Thumbnails with RMagick
Generating proportionally scaled image thumbnails in Rails using ImageMagick and RMagick
Rails link_to and HTML options
How to pass HTML attributes like title to the Rails link_to helper method
Self-Referential, Many-to-Many Relationships
Modeling a friends list in Rails using has_and_belongs_to_many with a self-referencing join table
Salted Hash Login Generator
Tips for getting the Rails SaltedHashLoginGenerator working properly