title: Accessing an instance method in an active record query
body: <p>Given the following two models:</p>
  
  <pre><code>class Wheel
    belongs_to :car
  
    def self.flat
      where(flat: true)
    end
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Car
    has_many :wheels
  
    def flats
      self.wheels.flat
    end
  
    def has_flats?
      flats.count &gt; 0
    end
  </code></pre>
  
  <p>I need a query for all cars with flat tires. I'm wondering why this isn't working in the cars model?:</p>
  
  <pre><code>def self.with_flats
    where(:has_flats?)
  end
  </code></pre>
  
  <p>or</p>
  
  <pre><code>def self.with_flats
    where(:has_flats? == true)
  end
  </code></pre>
  
  <p>This isn't returning the correct records. Any ideas?</p>