Category Archives: Rails

Watch me build an app (one day sale!)

As I posted a few months ago, the good folks at TekPub recently took my hours of footage of a weekend coding project and turned it into a tightly edited hour-and-fifteen-minute screencast. Well, as you might have heard, TekPub has … Continue reading

Posted in Announcements, Rails, Ruby, Screencasts, Videos | Leave a comment

Complete “Making of Cowsays.com” video now available from Tekpub

A long while back I gave myself a challenge: I was going to code up and launch a web app in a weekend. And I was going to narrate and record the whole process for later release as a screencast … Continue reading

Posted in Announcements, Rails, Ruby, Videos | Leave a comment

RubyTapas Episode 21: Domain Model Events

Today’s free Monday episode features a rare delving into Rails code. We take a look at a fat controller, and thin it down by identifying the model lifecycle events that are hiding inside it. This episode garnered a lot of … Continue reading

Posted in Rails, Ruby, RubyTapas Samples, Screencasts | 4 Comments

Configuring database_cleaner with Rails, RSpec, Capybara, and Selenium

How I avoid finding myself in database bizarro world while testing Rails apps. Continue reading

Posted in Rails, Ruby | Tagged , , , , , | 35 Comments

ActiveRecord Default Association Extensions

How to add helper methods to all associations of a given type, as well as to the model class. Continue reading

Posted in Rails | Tagged | 5 Comments

DRYing up your validations using DB reflection

Avoiding silent truncation of your model fields requires putting length validations on them. But this can introduce duplication of knowledge. In this post I demonstrate how to pull limit information directly from the DB into your model validations. Continue reading

Posted in Rails | Tagged , , , | 26 Comments

Your Code is My Hell

It occurred to me recently that my experience as a Rails developer may be somewhat unique. I often get brought in to help preexisting Ruby/Rails projects evolve and mature in a sustainable way. As a result, the vast majority of … Continue reading

Posted in Rails, Rants, Ruby | Tagged , , , , , | 125 Comments

View Sandboxes for Rails

Designing HTML views is an iterative, interactive process by nature. And anything that slows down the iterations, slows down development. I was working on a form recently where the steps to show it went something like this: Go to the … Continue reading

Posted in Howto, Rails | Tagged , | 14 Comments

Object Oriented Programming Comes to Rails

decent_exposure helps you program to an interface, rather than an implementation in your Rails controllers. Sharing state via instance variables in controllers promotes close coupling with views. decent_exposure gives you a declarative manner of exposing an interface to the state … Continue reading

Posted in Rails, Rants, Ruby | Tagged , , , | 5 Comments

Counters for Partials

Sometimes I like to number rows using a counter when rendering lists of things: <% @products.each_with_index do |product, i| %> <li class=”product_<%= i %>”><%= product.name %></li> <% end %> They are handy for testing, among other things. Of course, if … Continue reading

Posted in Rails, Ruby | Tagged , , , , | 2 Comments