The other big obstacle to Ruby's adoption is ActiveRecord

I have been using Ruby for a few months now, doing development of small projects of up to 1000 lines. But I still bite into the naming clashes with ActiveRecord regularily. They appear at random places and it takes a lot of experience to figure out what is happening. Here's an example with the type attribute clash. Of the two code snippets below, the first one does not work (thing.type equals nil, after execution), and the second one works.

thing = Thing.new(:type=> Type.new)
thing = Thing.new
thing.type = Type.new

Another example is having an attribute named transaction.

thing.transaction

Calling .save on a model with such an attribute will produce no output in the logs and leaves the developer in frustration about what happens.

Tags: