aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-15 17:46:09 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-15 17:46:09 +0100
commitedc176d33be9499f4c096779c5b4711b5daf0c06 (patch)
treec775c7643fca33a3ff18aaa724064e2a167c8616 /activerecord/lib/active_record/associations.rb
parentd619e399380cd840f9f5ec88bb3d823fbb1f4d08 (diff)
downloadrails-edc176d33be9499f4c096779c5b4711b5daf0c06.tar.gz
rails-edc176d33be9499f4c096779c5b4711b5daf0c06.tar.bz2
rails-edc176d33be9499f4c096779c5b4711b5daf0c06.zip
Make sure nested through associations are read only
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r--activerecord/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 22a693540e..1111033435 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -64,6 +64,12 @@ module ActiveRecord
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 HasManyThroughNestedAssociationsAreReadonly < ActiveRecordError #:nodoc
+ def initialize(owner, reflection)
+ super("Cannot modify association '#{owner.class.name}##{reflection.name}' because it goes through more than one other association.")
+ end
+ end
class HasAndBelongsToManyAssociationWithPrimaryKeyError < ActiveRecordError #:nodoc:
def initialize(reflection)