aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/reflection.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/reflection.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/reflection.rb')
-rw-r--r--activerecord/lib/active_record/reflection.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index b7cd466e13..ee63fcfce2 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -395,6 +395,10 @@ module ActiveRecord
chain
end
end
+
+ def nested?
+ through_reflection_chain.length > 2
+ end
# Gets an array of possible <tt>:through</tt> source reflection names:
#