# Problem saving object

**URL:** <https://www.ruby-forum.com/t/problem-saving-object/186071>\
**Category:** Rails\
**Created:** [March 31, 2010, 8:13am UTC](https://www.ruby-forum.com/t/problem-saving-object/186071 "2010-03-31T08:13:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [March 31, 2010, 8:13am UTC](https://www.ruby-forum.com/t/problem-saving-object/186071/1 "2010-03-31T08:13:33Z")

</div>

I’m using the Cache-Money gem on this app, and I’m getting this weird  
error whenever I try to create a new object.

Rails 2.3.5  
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86\_64-linux]

NoMethodError (undefined method `\<=\>’ for #Listing:0x2aaaae156e08):

This happens even in the console when I try to create a new Listing  
object and save it.

> > l = Listing.new  
> > l.name = “test”  
> > l.save  
> > NoMethodError: undefined method `\<=\>’ for #Listing:0x2b9595d76350

Has anyone ever seen this before? Have any ideas of where I should look?

Thanks,

~Jeremy

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [March 31, 2010, 5:28pm UTC](https://www.ruby-forum.com/t/problem-saving-object/186071/2 "2010-03-31T17:28:50Z")

</div>

On Tue, Mar 30, 2010 at 11:13 PM, Jeremy W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> NoMethodError (undefined method `\<=\>’ for #Listing:0x2aaaae156e08):
> 
> This happens even in the console when I try to create a new Listing  
> object and save it.
> 
> > > l = Listing.new  
> > > l.name = “test”  
> > > l.save  
> > > NoMethodError: undefined method `\<=\>’ for #Listing:0x2b9595d76350

Something’s trying to compare 2 Listing objects, which don’t have any  
such comparison method, apparently.

> > a = Object.new  
> > =\> #Object:0x1016b0498  
> > b = Object.new  
> > =\> #Object:0x1016ac848  
> > a \<=\> b  
> > NoMethodError: undefined method `\<=\>’ for #Object:0x1016b0498  
> > from (irb):22

Unlike, say:

> > Integer.respond\_to?(“\<=\>”)  
> > =\> true  
> > 4 \<=\> 5  
> > =\> -1  
> > 5 \<=\> 4  
> > =\> 1

So you need to find where that comparison is being made – since it’s  
on save possibly some validation?

## HTH,

Hassan S. ------------------------ removed\_email\_address@domain.invalid  
twitter: @hassan

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [March 31, 2010, 5:33pm UTC](https://www.ruby-forum.com/t/problem-saving-object/186071/3 "2010-03-31T17:33:58Z")

</div>

Hassan S. wrote:

> On Tue, Mar 30, 2010 at 11:13 PM, Jeremy W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > NoMethodError (undefined method `\<=\>’ for #Listing:0x2aaaae156e08):
> > 
> > This happens even in the console when I try to create a new Listing  
> > object and save it.
> > 
> > > > l = Listing.new  
> > > > l.name = “test”  
> > > > l.save  
> > > > NoMethodError: undefined method `\<=\>’ for #Listing:0x2b9595d76350
> 
> Something’s trying to compare 2 Listing objects, which don’t have any  
> such comparison method, apparently.
> 
> > > a = Object.new  
> > > =\> #Object:0x1016b0498  
> > > b = Object.new  
> > > =\> #Object:0x1016ac848  
> > > a \<=\> b  
> > > NoMethodError: undefined method `\<=\>’ for #Object:0x1016b0498  
> > > from (irb):22
> 
> Unlike, say:
> 
> > > Integer.respond\_to?(“\<=\>”)  
> > > =\> true  
> > > 4 \<=\> 5  
> > > =\> -1  
> > > 5 \<=\> 4  
> > > =\> 1
> 
> So you need to find where that comparison is being made – since it’s  
> on save possibly some validation?
> 
> ## HTH,
> 
> Hassan S. ------------------------ removed\_email\_address@domain.invalid  
> twitter: @hassan

Yeah, that much I’m certain of. The only thing I don’t know is maybe if  
cache-money does something with that when trying to save an object and  
throwing it into cache.

This all works perfectly fine on my local machine, just not on the  
production server. So I figure it’s some gem that only does certain  
things in production. I’m using Geokit too, so if anyone knows of any  
issue with either of these gems that might cause something like this,  
please let me know.

Thanks for the help.

~Jeremy

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [March 31, 2010, 5:41pm UTC](https://www.ruby-forum.com/t/problem-saving-object/186071/4 "2010-03-31T17:41:08Z")

</div>

On 31 March 2010 16:33, Jeremy W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > > > l.name = “test”  
> > > > > a \<=\> b  
> > > > > 5 \<=\> 4
> 
> Yeah, that much I’m certain of. The only thing I don’t know is maybe if  
> cache-money does something with that when trying to save an object and  
> throwing it into cache.
> 
> This all works perfectly fine on my local machine, just not on the  
> production server. So I figure it’s some gem that only does certain  
> things in production. I’m using Geokit too, so if anyone knows of any  
> issue with either of these gems that might cause something like this,  
> please let me know.

Can’t you see from the trace where it is failing?

Colin

---

<div class="post-metadata">

**Author:** ![nuby2ruby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/54ee81/32.png) [@nuby2ruby](https://www.ruby-forum.com/u/nuby2ruby)\
**Post date:** [March 31, 2010, 7:16pm UTC](https://www.ruby-forum.com/t/problem-saving-object/186071/5 "2010-03-31T19:16:39Z")

</div>

Colin L. wrote:

> On 31 March 2010 16:33, Jeremy W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > > > > > l.name = “test”  
> > > > > > a \<=\> b  
> > > > > > 5 \<=\> 4
> > 
> > Yeah, that much I’m certain of. The only thing I don’t know is maybe if  
> > cache-money does something with that when trying to save an object and  
> > throwing it into cache.
> > 
> > This all works perfectly fine on my local machine, just not on the  
> > production server. So I figure it’s some gem that only does certain  
> > things in production. I’m using Geokit too, so if anyone knows of any  
> > issue with either of these gems that might cause something like this,  
> > please let me know.
> 
> Can’t you see from the trace where it is failing?
> 
> Colin

Yeah, I looked through the trace, and it was nothing but all these  
cache-money calls. I figured it out though, had nothing to do with  
cache-money. It was Geokit. I just started commenting out lines until it  
worked, and taking out acts\_as\_mappable seemed to have fixed it \>.\< I’m  
sure this is a “hack” solution because it doesn’t make sense at all.  
Thanks for the help guys!

~Jeremy
