title: Why using merge method with scopes isn't working anymore on Rails 3.1?
body: <p>I stumbled upon a wonderful article about scopes on Rails 3+ : <a href="http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/index.html">http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/index.html</a></p>
  
  <p>You can read there (in 'Crazy Town' section) that it's possible to merge scopes from different models like this :</p>
  
  <pre class="lang-rb prettyprint-override"><code>class User &lt; ActiveRecord::Base
  
    scope :published, lambda {
      joins(:posts).group("users.id") &amp; Post.published
    }
  end
  </code></pre>
  
  <p>which works just as expected, and allows you to do :</p>
  
  <pre class="lang-rb prettyprint-override"><code>User.published.to_sql
  #=&gt; SELECT users.* FROM "users"
  #   INNER JOIN "posts" ON "posts"."author_id" = "users"."id"
  #   WHERE (posts.published_at IS NOT NULL AND posts.published_at &lt;= '2010-02-27 02:55:45.063181')
  #   GROUP BY users.id
  </code></pre>
  
  <p>I tried this approach in my Rails 3.1 project and apparently it's not working anymore.</p>
  
  <p>So I cloned the article's Rails 3.0.0-beta1 project, saw by my eyes that the guys are not lying and things are working the way they tell.</p>
  
  <p>Then I 3.1'ed it up, and now I get :</p>
  
  <pre class="lang-rb prettyprint-override"><code>ruby-1.9.2-p290 :003 &gt; User.published.to_sql
    User Load (0.3ms)  SELECT "users".* FROM "users" INNER JOIN "posts" ON "posts"."author_id" = "users"."id" GROUP BY users.id
    Post Load (0.2ms)  SELECT "posts".* FROM "posts" WHERE (posts.published_at IS NOT NULL AND posts.published_at &lt;= '2011-10-05 11:45:00.512231')
    User Load (0.1ms)  SELECT "users".* FROM "users" 
  NoMethodError: undefined method `to_sql' for []:Array
    from (irb):3
    from /home/jerefrer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start'
    from /home/jerefrer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start'
    from /home/jerefrer/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:40:in `&lt;top (required)&gt;'
    from script/rails:9:in `require'
    from script/rails:9:in `&lt;main&gt;'
  </code></pre>
  
  <p>==> Doesn't work anymore.</p>
  
  <p>And that makes me sad, because scope merging was awesome and now I can't be as DRY as I want.</p>
  
  <p>Do you know :</p>
  
  <ul>
  <li>What happened between the two versions ?</li>
  <li>Any other way to do the same ?</li>
  </ul>