A Ruby problem calculation problem - please help

I do not think that my problem is Rails but just my lack of
understanding of Ruby.

I am using ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] and
Rails 2.3.5

Code: First I evaluate @tot_hb to decide what discount is to be
applied. no problems here

  if @tot_hb > 0
    if @tot_hb > 399900
      @bd_disc = 0.80
    elsif @tot_hb > 199900
      @bd_disc = 0.85
    elsif @tot_hb > 99900
      @bd_disc = 0.90
    elsif @tot_hb > 49900
      @bd_disc = 0.95
     end
  end

Then I attempt to update @client.bd_rate with the value that is in
@db_disc. @client.bd_rate is a MySql Decimal(3,2) field with a default
of zero

@client.bd_rate = @db_disc

At this point things go pear shaped and I get the message: nil can’t
be coerced into Fixnum. I know that @db_disc has a value as if I do a
puts the value is displayed as 0.80

It would appear that it is some sort of conversion problem? Help would
be very much appreciated.

Regards,

Paul Thompson

Quoting Paul Jonathan T. [email protected]:

      @bd_disc = 0.80

@db_disc. @client.bd_rate is a MySql Decimal(3,2) field with a default

Typo in program or e-mail: @bd_disC OR @db_disc?

Jeffrey

Sorry guys, I got this sorted.