Re: [Rails] why does my method return an error if argument is not a number?

2011-03-28 Thread Michael Pavling
On 28 March 2011 22:02, John Merlino wrote: > If y is nothing (empty), the error occurs. If y is an integer the error > doesn't occur. yup. "divide by zero" will do that... > Doesn't this line take all non numbers like empty and > convert it to integer 0: > result.to_s == 'NaN' ? 0 : result > If

Re: [Rails] why does my method return an error if argument is not a number?

2011-03-28 Thread Phil Crissman
On Mon, Mar 28, 2011 at 4:02 PM, John Merlino wrote: > Hey all, > > I get the following error message: > ActionView::TemplateError (class or module required for rescue clause) > in app/vie$ app/helpers/format_helper.rb:116:in `divide_numbers' > > > Basically I have a field in database called Stud

[Rails] why does my method return an error if argument is not a number?

2011-03-28 Thread John Merlino
Hey all, I get the following error message: ActionView::TemplateError (class or module required for rescue clause) in app/vie$ app/helpers/format_helper.rb:116:in `divide_numbers' Basically I have a field in database called Student Fails and I populate fields with data. Sometimes the value can b