# Fixnum problem

**URL:** <https://www.ruby-forum.com/t/fixnum-problem/184738>\
**Category:** Rails\
**Created:** [March 7, 2010, 7:04pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738 "2010-03-07T19:04:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [March 7, 2010, 7:04pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738/1 "2010-03-07T19:04:22Z")

</div>

Sir can i know what is the meaning of the phrase ‘comparison of Fixnum  
with nil failed’

I want to pass two parameters to a method in a model file…  
bt wen i pass an integer then it gives the above error…  
Please help…

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [March 7, 2010, 7:56pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738/2 "2010-03-07T19:56:38Z")

</div>

Manish B. wrote:

> Sir can i know what is the meaning of the phrase ‘comparison of Fixnum  
> with nil failed’
> 
> I want to pass two parameters to a method in a model file…  
> bt wen i pass an integer then it gives the above error…  
> Please help…

Sounds like an Enumerable error.

$ irb  
[nil, 1].max  
ArgumentError: comparison of Fixnum with nil failed

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [March 7, 2010, 8:09pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738/3 "2010-03-07T20:09:28Z")

</div>

On Sun, Mar 7, 2010 at 12:04 PM, Manish B.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)wrote:

> Sir can i know what is the meaning of the phrase ‘comparison of Fixnum  
> with nil failed’
> 
> I want to pass two parameters to a method in a model file…  
> bt wen i pass an integer then it gives the above error…  
> Please help… [http://www.ruby-forum.com/](http://www.ruby-forum.com/)

One of your numbers doesn’t have a value, it is nil. Is nill more than  
1?  
Less than 1? Is it more than 1000? Less than 1000?

It doesn’t make sense to compare nil to a number, so, for example, the  
code  
“1 \< nil” will raise “ArgumentError: comparison of Fixnum with nil  
failed”

You need to figure out which parameter was nil, how it got that way, and  
what you need to do in this situation.

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [March 7, 2010, 8:51pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738/4 "2010-03-07T20:51:01Z")

</div>

On Sun, Mar 7, 2010 at 1:15 PM, Manish B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> You received this message because you are subscribed to the Google G.  
> “Ruby on Rails: Talk” group.  
> To post to this group, send email to removed\_email\_address@domain.invalid.  
> To unsubscribe from this group, send email to  
> removed\_email\_address@domain.invalid[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> .  
> For more options, visit this group at  
> [http://groups.google.com/group/rubyonrails-talk?hl=en](http://groups.google.com/group/rubyonrails-talk?hl=en).

Changing the name won’t fix the problem in your code.

Post the code for the method (or look to see where your params are  
compared)

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [March 7, 2010, 8:15pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738/5 "2010-03-07T20:15:51Z")

</div>

Sir i have now tried to declare a same method twice with a different  
name but the same parameter to both the methods…  
Bt i still get that fixnum problem…  
i want to know that calling two different name methods in on Model file  
works.?  
how to resolve that error?

---

<div class="post-metadata">

**Author:** ![manish\_belsare](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/7993a0/32.png) [@manish\_belsare](https://www.ruby-forum.com/u/manish_belsare)\
**Post date:** [March 7, 2010, 8:52pm UTC](https://www.ruby-forum.com/t/fixnum-problem/184738/6 "2010-03-07T20:52:12Z")

</div>

On Mar 7, 7:15 pm, Manish B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Sir i have now tried to declare a same method twice with a different  
> name but the same parameter to both the methods…  
> Bt i still get that fixnum problem…  
> i want to know that calling two different name methods in on Model file  
> works.?  
> how to resolve that error?

Look at the backtrace and try and figure out (perhaps using the  
debugger) what is nil when it shouldn’t be

Fred
