From 796295dba6839bf417c19a2f41fe2a32d968367a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Sun, 5 Feb 2006 17:39:54 +0000 Subject: [PATCH] ActiveRecord::RecordInvalid now states which validations failed in its default error message git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3544 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/CHANGELOG | 2 ++ activerecord/lib/active_record/validations.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 111d645ea9..32cb4562a0 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* ActiveRecord::RecordInvalid now states which validations failed in its default error message [Tobias Luetke] + * Using AssociationCollection#build with arrays of hashes should call build, not create [DHH] * Remove definition of reloadable? from ActiveRecord::Base to make way for new Reloadable code. [Nicholas Seckar] diff --git a/activerecord/lib/active_record/validations.rb b/activerecord/lib/active_record/validations.rb index 3ba2f12ac1..7d1661449c 100755 --- a/activerecord/lib/active_record/validations.rb +++ b/activerecord/lib/active_record/validations.rb @@ -8,9 +8,9 @@ module ActiveRecord # end class RecordInvalid < ActiveRecordError attr_reader :record - def initialize(record, *args) + def initialize(record) @record = record - super(*args) + super("Validation failed: #{@record.errors.full_messages.join(", ")}") end end