You can clone with
HTTPS or Subversion.
I found this while running my specs. For a full description of the problem please have a look here rspec/rspec-core#413 and here rspec/rspec-expectations#80
Here's a script to reproduce:
rails new example
rails generate model thing name:string
Now, in the console:
> [Thing.create!, Thing.create!].sort
ArgumentError: comparison of Thing with Thing failed
from (irb):1:in `sort'
@dchelimsky thanks for the code snippet, excellent :)
I'm getting a NoMethodError: undefined method `<=>' for #Thing:0x5453210 on both edge and 3.1.0.rc4.
NoMethodError: undefined method `<=>' for #Thing:0x5453210
Try it in ruby 1.9.2 :)
To be clear, I get NoMethodError: undefined method '<=>' for #Thing with 3.1.0.rc4 on ruby 1.8.7, but I get the ArgumentError on ruby 1.9.2.
NoMethodError: undefined method '<=>' for #Thing
ArgumentError also on edge + ruby 1.9.2
The error is actually the same for 1.8 and 1.9.
ActiveRecord::Base needs to respond to <=>.
I've fixed it by sorting by id in #1860.
allow comparison on model objects - Closes #1858