diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-05-11 08:55:36 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-11 08:56:01 +0100 |
commit | 1dd90f8f12d1904ee3db37f9390df3246bb2712b (patch) | |
tree | af878256f943714b18e07be9f1238ddd3fe47b71 /activerecord/lib/active_record | |
parent | aa1fc1c88cb58b6387cb7a8560aac78ef56fa024 (diff) | |
download | rails-1dd90f8f12d1904ee3db37f9390df3246bb2712b.tar.gz rails-1dd90f8f12d1904ee3db37f9390df3246bb2712b.tar.bz2 rails-1dd90f8f12d1904ee3db37f9390df3246bb2712b.zip |
Don't use select() values from the join model of a through association. Fixes #508.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/through_association.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb index e436fef46d..53c5c3cedf 100644 --- a/activerecord/lib/active_record/associations/through_association.rb +++ b/activerecord/lib/active_record/associations/through_association.rb @@ -14,9 +14,10 @@ module ActiveRecord def target_scope scope = super chain[1..-1].each do |reflection| - # Discard the create with value, as we don't want that the affect the objects we - # create on the association - scope = scope.merge(reflection.klass.scoped.create_with(nil)) + scope = scope.merge( + reflection.klass.scoped.with_default_scope. + except(:select, :create_with) + ) end scope end |