Ruby on Rails
Building web applications with Rails -- from quick tips on migrations and routes to deployment patterns and gem integrations.
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.
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.
Honeypot Captchas for Rails
A simple, unobtrusive way to try to combat automated form spam.
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.
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
Freebootr Ahoy!
Launching a pirate-themed site for finding and posting free items in your area
Quick Tip: Rails 2.1 Time Zones
Setting your application time zone in Rails 2.1 with config.time_zone
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: 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
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
Discover your missing specs
A rake task that finds app files without corresponding RSpec test files and generates them
Gravatar Problems
Debugging and fixing the Mephisto Gravatar caching plugin for production use
Testing a helper with a block
Two approaches to testing a Rails helper method that accepts a block using RSpec
Stubbing controller methods in a helper test
In RSpec helper tests, the controller context is self -- use self.stub! to mock controller methods
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
Getting Opinionated
How learning Ruby on Rails reignited my passion for software and changed the way I communicate
Ruby on Rails Resources for Newbies
A curated list of books, screencasts, and subscriptions for learning Ruby on Rails
RailsConf 2007: Technology
Highlights from sessions on JavaScript, REST, Capistrano, Solr, and practical design for developers
RailsConf 2007
Preparing for RailsConf 2007 in Portland by watching DHH's keynote from last year
Ruby on Rails Testing - login gotcha
A workaround for testing controllers that require admin login from a different controller
Ruby on Rails Code Coverage
Using rcov to track test coverage in a Ruby on Rails project
Ruby on Rails Testing - flash.now gotcha
How to test flash.now values that get cleared after rendering the view
Contracting
Finishing my first contract project and discovering Ruby on Rails testing along the way
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