Mar 6
Suppose you have this:
class Widget < ActiveRecord::Base def errors [1,2] end end
where errors is a supposedly harmless, unrelated method that returns errors related to your Widgets. Then, try the following in your controller:
wdgt = Widget.new wdgt.save!
and you will get a message saying something like
NoMethodError (undefined method `full_messages' for #<Array:0x00000102344c68>)
This is because rails tries to print out wdgt.errors.full_messages, and fails to find full_messages on the array [1,2] returned by your custom errors method.
Thus, my rails hint: don’t create an errors method in an activerecord model.