Guides, tips, tutorials, and techniques to help you in the development and maintenance of your Ruby on Rails applications. Covers Active Record associations, models, views, controllers, helpers, and more.


Getting Started with Engines in Ruby on Rails, Part One

Engines in Ruby on Rails provide a great way to package functionality for reuse by modularizing a complete MVC stack. This article, the first of two parts, presents tips and techniques for creating, integrating, and extending engines in Rails.

Benchmarking Array Comparisons in Ruby

There are more ways to compare arrays in Ruby than you might think, but they're definitely not all created equal. Choosing the wrong method can negatively impact the performance of your application.

Creating a Heatmap or Tag Cloud in Rails

Histograms are often displayed as a tag-cloud-style heatmap. This article shows you how to easily create a heatmap in Rails and provides a link to a Rails plugin to let you automatically add this functionality to your project.


Drag and Drop With Nested Sets in Rails

If you're using Chris Bailey's Better Nested Set (or better yet, Brandon Keeper's awesome_nested_set) for your Ruby on Rails models, you may one day want to implement a drag-and-drop interface to reorganize your sets. Here's how I was able to implement it. ...

Nested Sets and Single-Table Inheritance

Provides a solution for problems raised by nested sets and single-table inheritance (STI).


Using counter_cache with STI Models

The counter_cache option for Rails relationships is invaluable in speeding up performance by reducing the number SQL queries, but there are a couple of things that you need to do to ensure that your counts start off right and to make the whole thing work with STI-based models.

Introspection & Reflection for Rails Controllers

Shows how to get a list of your Rails app's controllers in one line of code, plus tips for reflecting on controller methods and searching for controllers that match certain criteria.


Quickly Profile an ActiveRecord Model

Quickly determine an ActiveRecord model's attributes from script/console.

Date and Time Based ActiveRecord Find Conditions and Time Zone Support

Date and time based ActiveRecord find conditions may not work the way you expect after specifying a time zone to your Ruby on Rails application's environment settings.


RDocs for Local RubyGems In Your Browser

Learn how to access RDocs for locally-installed gems right from your browser.

DRY Your Google Queries with the Custom Ruby on Rails Search Engine

How many times have you searched for something Ruby on Rails-related on Google, and come up with search results having to do with rapid transit? Or page after page of Git commit messages? Sure, you could add "ruby on rails" to your search query, but having ...


Rails ActiveRecord Relationships Flowchart

Rails makes it easy to create and manage relationships between objects with Active Record. This AR cheat sheet makes it easy to remember.

Confusion over Convention: Ambiguous Helper Methods

If you're a Rails developer, you've probably seen "helper :all" a thousand times near the top of your generated application.rb file, but do you know what it really means? Learn how to avoid ambiguous helper methods.


Add Filters to Views Using Named Scopes in Rails

Use named scopes and a helper method in Ruby on Rails to let users automatically filter the items in a view.



RSS Feed