Dan Harper
2006-Mar-25 02:46 UTC
[Rails] undefined local variable or method `errors'' for Customer:Class
If I add the following line to my customer model: errors.add(:shipping_address_postcode, "has invalid format") unless :shipping_address_postcode =~ /[0-9]*/ I get an error when trying to save a record: undefined local variable or method `errors'' for Customer:Class I got this example from the Agile book. Anyone know what I''ve missed? Thanks, Dan
Dan Harper
2006-Mar-25 02:55 UTC
[Rails] undefined local variable or method `errors'' for Customer:Class
Dan Harper wrote:> If I add the following line to my customer model: > errors.add(:shipping_address_postcode, "has invalid format") unless > :shipping_address_postcode =~ /[0-9]*/ > > I get an error when trying to save a record: > > undefined local variable or method `errors'' for Customer:ClassIt''s OK, I figured it out. I needed to put this line in a "def validate" section. Dan
Apparently Analagous Threads
- undefined local variable or method `invoices' for Provider:Class
- undefined local variable or method `errors' for Listing:Clas
- Two Customer Types - Best Design Principle?
- Assessing Customer Satisfaction and Agile Project Management - PhD Dissertation
- getting error like undefined local variable or method `confi