aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-27 18:51:32 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-27 18:51:32 +0000
commit4b639904d7bc4407657767bb963997bc78678d03 (patch)
tree8819aed22cbcd90b7decee02639a275adbf01572 /activerecord/lib/active_record/associations.rb
parentcf9be897b81b5cda0282fb3439c11af6032ecedb (diff)
downloadrails-4b639904d7bc4407657767bb963997bc78678d03.tar.gz
rails-4b639904d7bc4407657767bb963997bc78678d03.tar.bz2
rails-4b639904d7bc4407657767bb963997bc78678d03.zip
Fix has_many :through delete with custom foreign keys. Closes #6466.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index b64b339781..e542e8d85a 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -49,6 +49,12 @@ module ActiveRecord
end
end
+ class HasManyThroughCantDissociateNewRecords < ActiveRecordError #:nodoc:
+ def initialize(owner, reflection)
+ super("Cannot dissociate new records through '#{owner.class.name}##{reflection.name}' on '#{reflection.source_reflection.class_name rescue nil}##{reflection.source_reflection.name rescue nil}'. Both records must have an id in order to delete the has_many :through record associating them.")
+ end
+ end
+
class EagerLoadPolymorphicError < ActiveRecordError #:nodoc:
def initialize(reflection)
super("Can not eagerly load the polymorphic association #{reflection.name.inspect}")