Fixnum problem

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..

Manish Belsare 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

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.

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?

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)

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