title: 'includes' method doesn't seem to work with 'where' in Rails 4
body: <p>In my Model I have:</p>
  
  <pre><code>class Song &lt; ActiveRecord::Base
  
    belongs_to :artist
  
    def self.default_scope
      includes :artist
    end
  
    def self.search query
      if query
        where "title LIKE :query OR artists.name LIKE :query", query: "%#{ query }%"
      else
        where nil
      end
    end
  
  end
  </code></pre>
  
  <p>And in my controller:</p>
  
  <pre><code>def index
    @songs = Song.search(params[:search])
    respond_with(@songs)
  end
  </code></pre>
  
  <p>When I search I get the following error:</p>
  
  <pre><code>Mysql2::Error: Unknown column 'artists.name' in 'where clause': SELECT  `songs`.* FROM `songs` WHERE (title LIKE '%my search%' OR artists.name LIKE '%my search%' OR albums.name LIKE '%my search%')
  </code></pre>
  
  <p>What am I doing wrong?, I thought the includes method would make the join automatically.</p>