11175
(-- --)
January 10, 2008, 4:38pm
1
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:in
`method_missing'
radar
(Ryan Bigg)
January 10, 2008, 8:49pm
2
Can you show us the whole model please?
bphogan
(Brian P. Hogan)
January 10, 2008, 9:35pm
3
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.