class RepairTicket < ActiveRecord::Base def calc_iva total_price=total_price+1000 end end>> r=RepairTicket.find(74) >> r.calc_ivaNoMethodError: 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'' -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Can you show us the whole model please? On Jan 11, 2008 3:08 AM, John Smith <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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'' > -- > Posted via http://www.ruby-forum.com/. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Jan 10, 2008 2:49 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Can you show us the whole model please? > > On Jan 11, 2008 3:08 AM, John Smith <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > > > 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'' > > -- > > Posted via http://www.ruby-forum.com/ . > > > > > > > > > > > -- > Ryan Bigg > http://www.frozenplague.net > Feel free to add me to MSN and/or GTalk as this email. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I Made the RepairTicket model with a migration, but it has a total_price :integer, default => 0. I have to try de reload! too. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---