title: Scope exception rules
body: <p>I am trying to define an inventory for all my articles but I want to exclude the articles that are sent to me with a parameter.</p>
  
  <p>Here is what the relationship looks like:</p>
  
  <pre><code>  Article
      has_many :tags, through: :articletags
    ArticleTags
      belongs_to :article
      belongs_to :tags
    Tags
      has_many :article, through: articletags
  </code></pre>
  
  <p>Here's a method to define the one without the tags in my models:</p>
  
  <pre><code>def self.by_not_tags(tag)
    joins(:tags).where('tags.title != ?', tag)
  end
  </code></pre>
  
  <p>Here's how I call it in my view:</p>
  
  <pre><code>&lt;%= link_to (tag.title), articles_path(:scope =&gt; tag.title) %&gt;
  </code></pre>
  
  <p>Here's my controller:</p>
  
  <pre><code> def custom
      if params[:scope].nil?
        @articles = Article.all(:order =&gt; 'created_at DESC')
      else
        @articles = Article.by_tags(params[:scope])
        @articles2 = Article.by_not_tags(params[:scope])
      end
    end
  </code></pre>
  
  <p>The goal is to see all the articles with a tag first, and then to show the other ones without that tag, so I don't have duplicates.</p>
  
  <p>My issue is with the joins, but I am not sure how to find the article without tags. Maybe an except would work, but I am not sure what kind of query would work for it.</p>