Rails Class Collisions

August 23rd, 2008

While trying to use Integrum’s oh-so-nifty missing spec finder on a recent project, I discovered that it was not working. Hmmm… seems that somewhere along the way Rails added detection for existing constants and won’t allow you to re-generate something. Instead it calls raise_class_collision, which raises a UsageError. Damn them.

Anyway, to work around this for now, you can add the following somewhere (e.g., an initializer):

require 'rails_generator/base'
require 'rails_generator/commands'

module Rails
  module Generator
    module Commands
      class Create
        def raise_class_collision(class_name)
          # Do Nothing
        end
      end
    end
  end
end

This should get around that inconvenience. Plus, you won’t be exposed to nefarious suggestions like I was:

$ rake spec:sync
  The name 'User' is either already used in your application or reserved by Ruby on Rails.
  Please choose an alternative and run this generator again.

  Suggestions:  

exploiter
drug user
substance abuser

Thanks Rails, you’re so helpful! I just don’t understand how it could have known I was building a Facebook clone for junkies…

Other Resources

USPS

July 16th, 2007

My wife recently ordered stamps online through the USPS. They arrived after several weeks delay in a giant envelope. Here is a picture of the envelope and the contents. Ridiculous.

Giant envelope, tiny stamps

Stick Figure Animations

November 21st, 2006

If you enjoy stick figure animations, such as Xiao Xiao stick figure kung fu, then you may like these as well.

Animator vs. Animation

The second one was released recently over at Atom Films. View it there:

Animator vs. Animation II

Hey, when you’re working 100 hour weeks, you gotta take a break sometimes!

Considering investing

October 21st, 2006

I just found out about this great, new company called Qeeglixtr. I am seriously considering investing because their idea is going to be the next big thing. Let me know what you think about it!