<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1457,7 +1457,7 @@ module ActiveRecord #:nodoc:
 
         def construct_finder_sql(options)
           scope = scope(:find)
-          sql  = &quot;SELECT #{(scope &amp;&amp; scope[:select]) || options[:select] || (options[:joins] &amp;&amp; quoted_table_name + '.*') || '*'} &quot;
+          sql  = &quot;SELECT #{options[:select] || (scope &amp;&amp; scope[:select]) || (options[:joins] &amp;&amp; quoted_table_name + '.*') || '*'} &quot;
           sql &lt;&lt; &quot;FROM #{(scope &amp;&amp; scope[:from]) || options[:from] || quoted_table_name} &quot;
 
           add_joins!(sql, options, scope)</diff>
      <filename>activerecord/lib/active_record/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -50,6 +50,22 @@ class MethodScopingTest &lt; ActiveRecord::TestCase
     end
   end
 
+  def test_scoped_find_select
+    Developer.with_scope(:find =&gt; { :select =&gt; &quot;id, name&quot; }) do
+      developer = Developer.find(:first, :conditions =&gt; &quot;name = 'David'&quot;)
+      assert_equal &quot;David&quot;, developer.name
+      assert !developer.has_attribute?(:salary)
+    end
+  end
+
+  def test_options_select_replaces_scope_select
+    Developer.with_scope(:find =&gt; { :select =&gt; &quot;id, name&quot; }) do
+      developer = Developer.find(:first, :select =&gt; 'id, salary', :conditions =&gt; &quot;name = 'David'&quot;)
+      assert_equal 80000, developer.salary
+      assert !developer.has_attribute?(:name)
+    end
+  end
+
   def test_scoped_count
     Developer.with_scope(:find =&gt; { :conditions =&gt; &quot;name = 'David'&quot; }) do
       assert_equal 1, Developer.count</diff>
      <filename>activerecord/test/cases/method_scoping_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>cf6299dbd73a8cb6d74265df03d01abe885e686a</id>
    </parent>
  </parents>
  <author>
    <name>Andrew White</name>
    <email>andyw@pixeltrix.co.uk</email>
  </author>
  <url>http://github.com/rails/rails/commit/235d635708dd72bee0828457af5397c79750483a</url>
  <id>235d635708dd72bee0828457af5397c79750483a</id>
  <committed-date>2008-05-29T06:10:24-07:00</committed-date>
  <authored-date>2008-05-29T04:59:29-07:00</authored-date>
  <message>Ensure :select passed in options overrides the one from the scope. [#239 state:resolved]

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>51f09f956b8f4d84d6f0e81dd697d577ffcd7f92</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
