aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb2
-rwxr-xr-xactiverecord/lib/active_record/base.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index 104ed5ba58..dafae89861 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -106,7 +106,7 @@ module ActiveRecord
def construct_scope
{
- :find => { :from => construct_from, :conditions => construct_conditions, :joins => construct_joins },
+ :find => { :from => construct_from, :conditions => construct_conditions, :joins => construct_joins, :select => construct_select },
:create => { @reflection.primary_key_name => @owner.id }
}
end
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index facb22c0e9..c58a7bf5c2 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -873,7 +873,7 @@ module ActiveRecord #:nodoc:
method_scoping.assert_valid_keys([ :find, :create ])
if f = method_scoping[:find]
- f.assert_valid_keys([ :conditions, :joins, :from, :offset, :limit, :readonly ])
+ f.assert_valid_keys([ :conditions, :joins, :select, :from, :offset, :limit, :readonly ])
f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
end
@@ -980,7 +980,7 @@ module ActiveRecord #:nodoc:
end
def construct_finder_sql(options)
- sql = "SELECT #{options[:select] || '*'} "
+ sql = "SELECT #{scope(:find, :select) || options[:select] || '*'} "
sql << "FROM #{scope(:find, :from) || options[:from] || table_name} "
add_joins!(sql, options)