What's wrong with this model method?

class RepairTicket < ActiveRecord::Base

def calc_iva
total_price=total_price+1000
end

end

r=RepairTicket.find(74)
r.calc_iva
NoMethodError: undefined method calc_iva' for #<RepairTicket:0x29293dc> from /Users/juan/Desktop/dticket/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:205:inmethod_missing’

Can you show us the whole model please?

On Jan 11, 2008 3:08 AM, John S. [email protected]
wrote:

r=RepairTicket.find(74)


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

This is a guess:

You’re testing in console and adding methods. Console doesn’t auto
reload.

When you make a change to a model, type this:

reload!

You’ll have to re-instantiate your objects too.

I recommend unit testing instead, which it appears that you’re doing
manually.

Again, just guessing.

I Made the RepairTicket model with a migration, but it has a total_price
:integer, default => 0.
I have to try de reload! too.