Category Archives: Tips

Choosing Which Version of a Gem to Run

Paul Sturgess posted a nice little tip on how to How to use Capistrano 1.x to deploy Ruby on Rails apps when you have Cap 2.x. Basically, the following syntax will allow you to choose which version of a gem to run:
cap _1.4.1_ deploy
Or say you want to generate a 1.2.3 rails app:
rails _1.2.3_ […]

jQuery: Embedding Behavior

The fellows over at Err have finally seen the light of jQuery. My first thought is welcome to the party, we’ve been wondering when you’d get here. From my first days with rails, I’ve been using jQuery over Prototype. Why? Well, a lot of reasons, but the biggest one is because […]

has_many :through: Finding unassociated objects

has_many :through: Finding unassociated objects
Awesomeness.

Tip: Return True for Model Hooks

Everyone loves before_create and before_save. Recently it came in very handy for logging hits to objects. If the user is logged in, I want to store the user’s full name and the user’s type, otherwise, keep those null. So I added this to my PostHit model:
 
def before_create
if self.user
self.user_name = […]