From 00a5fd3d18ac908af688c5944922cf69c56e850b Mon Sep 17 00:00:00 2001 From: Michael Schuerig Date: Sun, 5 Apr 2009 01:42:21 +0200 Subject: Translate foreign key violations to ActiveRecord::InvalidForeignKey exceptions. Signed-off-by: Michael Koziarski --- activerecord/lib/active_record/base.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib/active_record/base.rb') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index defe1b56b6..027ab8af9e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -71,6 +71,10 @@ module ActiveRecord #:nodoc: class RecordNotUnique < StatementInvalid end + # Raised when a record cannot be inserted or updated because it references a non-existent record. + class InvalidForeignKey < StatementInvalid + end + # Raised when number of bind variables in statement given to :condition key (for example, when using +find+ method) # does not match number of expected variables. # -- cgit v1.2.3