title: Filter table by tags provided - active record
body: <p>I have the below tables</p>
  
  <ol>
  <li>User</li>
  <li>Article</li>
  <li>Tags (1 to many)</li>
  </ol>
  
  <p>Tags can be applied for both the user and articles . (user tags are tags to be blacklisted - i.e do not show articles tagged with user submitted tags). As such they have the below columns</p>
  
  <ol>
  <li>id</li>
  <li>taggable_type ('article' or 'user')</li>
  <li>title  (string)</li>
  <li>taggable id (the relevant article id or the userid)</li>
  </ol>
  
  <p>When the user performs a get request , i would like to have activerecord filter out all articles with the provided user blacklisted tags.</p>
  
  <p>i perform the below operation to get an array of user blacklisted tags</p>
  
  <pre><code>if user != nil
    user_tags = user.tags
    blacklisted_tags = []
    user_tags.each do |user|
      blacklisted_tags.push(user.title)
    end
    puts "\n \n \n user tags - #{blacklisted_tags} \n \n \n"
  end
  
  blacklisted_tags = ['foo','bar']
  </code></pre>
  
  <p>I cant seem to get activerecord to properly filter out any article tagged with any of the blacklisted_tags.</p>
  
  <p>this is what i've done so far</p>
  
  <pre><code>negations[:tags] = "tags.title not in #{blacklisted_tags}"
  
  @articles = Article.order(followed).left_outer_joins(:tags).where.not(negations)
  </code></pre>
  
  <p>i get the below sql error -</p>
  
  <pre><code>(Mysql2::Error: Unknown column 'articles.taggable_id' in 'where clause': SELECT  `articles`.* FROM `articles` LEFT OUTER JOIN `tags` ON `tags`.`taggable_id` = `articles`.`id` AND `tags`.`taggable_type` = 'article' WHERE (`articles`.`taggable_id` != 'tags.title not in [\"foo\", \"bar\"]')
  </code></pre>
  
  <p>Where is rails getting the 'articles.taggable_id' from?</p>
  
  <p>Is there a better way to approach this?</p>