Wednesday, March 12, 2008

unit test errors.full_messages




I recently needed to check why a model in Rails was failing, and I found the following useful. It tells me all the errors that have occurred to stop this model from validating:


@sness_aug01_medium_bin.valid?
puts "errors=(#{@sness_aug01_medium_bin.errors.full_messages})"