title: Rails: Best way to query across multiple models
body: <p>I have got a simple rails app, with three models, and what I am trying to do is query across the different models.</p>
  
  <p>My app models are as follows:</p>
  
  <pre><code>user.rb:
      has_many :forms
      has_one :user_info
  
  user_info.rb
      attr_accessible :state
  
  form.rb:
      attr_accessible :status
      belongs_to :user
  </code></pre>
  
  <p>What i am trying to do, is to see how many users have a certain status, and who live in a specific state. Essentially, I am trying to do the something like this:
      .where("status = ? AND state = ?", "open", "AZ")</p>
  
  <p>Is there a rails way to do this sort of query?
  Thanks in advance for your help,</p>