aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Lütke <tobias.luetke@gmail.com>2006-02-05 17:39:54 +0000
committerTobias Lütke <tobias.luetke@gmail.com>2006-02-05 17:39:54 +0000
commit796295dba6839bf417c19a2f41fe2a32d968367a (patch)
tree7734d3934c5f2ab94213cb6d148d52d52b6ba328
parent0633bb865bc755d4a67d6ade8ca588d2f3107b0f (diff)
downloadrails-796295dba6839bf417c19a2f41fe2a32d968367a.tar.gz
rails-796295dba6839bf417c19a2f41fe2a32d968367a.tar.bz2
rails-796295dba6839bf417c19a2f41fe2a32d968367a.zip
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
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/validations.rb4
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