diff options
author | Yuki Nishijima <mail@yukinishijima.net> | 2015-01-06 04:31:08 -0800 |
---|---|---|
committer | Yuki Nishijima <mail@yukinishijima.net> | 2015-05-01 19:01:41 -0700 |
commit | ad5824bde0f63d5bb2e33b7fe86904d1fbd7ff95 (patch) | |
tree | 6a3dc7ce4fce9afe9e54c11d9a573bff8d3297fe /activerecord/lib/active_record/errors.rb | |
parent | 2e7fd4a8661960434ccaad71c8afb4ef26281d21 (diff) | |
download | rails-ad5824bde0f63d5bb2e33b7fe86904d1fbd7ff95.tar.gz rails-ad5824bde0f63d5bb2e33b7fe86904d1fbd7ff95.tar.bz2 rails-ad5824bde0f63d5bb2e33b7fe86904d1fbd7ff95.zip |
AR::RecordNotSaved & RecordNotDestroyed should include an error message
When `AR::Base.save!` or `AR::Base.destroy!` is called and an exception
is raised, the exception doesn't have any error message or has a weird
message like `#<FailedBulb:0x0000000907b4b8>`. Give a better message so
we can easily understand why it's failing to save/destroy.
Diffstat (limited to 'activerecord/lib/active_record/errors.rb')
-rw-r--r-- | activerecord/lib/active_record/errors.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/errors.rb b/activerecord/lib/active_record/errors.rb index 98aee77557..0f1759abaa 100644 --- a/activerecord/lib/active_record/errors.rb +++ b/activerecord/lib/active_record/errors.rb @@ -71,9 +71,9 @@ module ActiveRecord class RecordNotDestroyed < ActiveRecordError attr_reader :record - def initialize(record) + def initialize(message, record = nil) @record = record - super() + super(message) end end |