/me@(voip.)?|www./ SamLown.com

Rails: NilClass no longer extended with a < method in Rails 2.1

I discovered a strange change in Rails 2.1 today when I found a bit of faulty code that used to work in Rails 2.0. Rather than try to describe it, here’s a quick example:

planetaki@Planetaki1:~/Planetaki$ ./script/console 
Loading production environment (Rails 2.0.2)
>> @x < 10
=> false

And in Rails 2.1:

sam@dell-desktop:~/workspace/Planetaki$ ./script/console 
Loading development environment (Rails 2.1.0)
>> @x < 10
NoMethodError: You have a nil object when you didn't expect it!
The error occurred while evaluating nil.<
     from (irb):1

After a quick search I’ve not managed to find anything specific that would cause this in the Rails libraries, and on both systems performing the test on the standard irb console will cause an exception as expected. Very strange. Let me know if you have any ideas!

written by Sam,


No comments yet


Write your comment



HTML will be removed, but Textile formating is permitted. Log in for your comment to be posted without review.