From 2e47db2fbd7ea381e3680ffa8ee0ae8547078970 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 5 Dec 2007 21:53:53 +0000 Subject: Fixed that habtm associations should be able to set :select as part of their definition and have that honored [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8313 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../active_record/associations/has_and_belongs_to_many_association.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb index 3d10721af6..b26ea586e5 100644 --- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb @@ -47,7 +47,7 @@ module ActiveRecord options[:conditions] = conditions options[:joins] = @join_sql - options[:readonly] = finding_with_ambiguous_select?(options[:select]) + options[:readonly] = finding_with_ambiguous_select?(options[:select] || @reflection.options[:select]) if options[:order] && @reflection.options[:order] options[:order] = "#{options[:order]}, #{@reflection.options[:order]}" @@ -57,7 +57,7 @@ module ActiveRecord merge_options_from_reflection!(options) - options[:select] ||= '*' + options[:select] ||= (@reflection.options[:select] || '*') # Pass through args exactly as we received them. args << options -- cgit v1.2.3