diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-10-15 17:46:09 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2010-10-15 17:46:09 +0100 |
commit | edc176d33be9499f4c096779c5b4711b5daf0c06 (patch) | |
tree | c775c7643fca33a3ff18aaa724064e2a167c8616 /activerecord/lib/active_record/associations.rb | |
parent | d619e399380cd840f9f5ec88bb3d823fbb1f4d08 (diff) | |
download | rails-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.rb | 6 |
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) |