title: ruby remove common element collections
body: <p>I have three classes: User, Subscription and Plan. I want to load all of the Plans that the User doesn't have. What's the best way to do it in Rails?</p>
  
  <p>I have two collections: <code>current_user.subscriptions</code> and <code>Plan.where(active: true)</code>
  And i am using mongoid</p>
  
  <pre><code>def dashboard
    @plans = Plan.where(active: true)#.each { @plans.delete_if has_current_user_plan      subscription.title }
  end
  
  def has_current_user_plan(name)
    current_user.subscriptions.where(title: name, active: true).exists?
  end
  </code></pre>
  
  
  
  <pre><code>class User
    has_many :subscriptions
  </code></pre>
  
  
  
  <pre><code>class Subscription
    belongs_to :plan
    belongs_to :user
  </code></pre>
  
  
  
  <pre><code>class Plan
    has_many :subscriptions
  </code></pre>