title: Help with action MAIL
body: <pre><code>require 'config/environment'
  
  inquiry               = Inquiry.find(:all, :conditions =&gt; ["is_answered = 0"])
  
  inquiry.each do |i|   
      question          = i.question 
      user              = User.find(:first, :conditions =&gt; ["id = ?", question.user_id])
  
      Notifier.deliver_deadline_notification(inquiry, user, question)
  end
  </code></pre>
  
  <p>I have table <code>inquiry</code> (relationship table) with <code>is_answered</code> field (for example).</p>
  
  <p>What I need? I need to send email people who are <code>NOT answered</code> on my question (<code>is_answered = 0</code>). So Now works this way: i received <code>2</code> emails (because  i have in database 1 question and 2 users who are not answered) :</p>
  
  <pre><code>id | question_id | is_answered
  14 |     11      |     0
  24 |     11      |     0
  </code></pre>
  
  <p>So, i need to receive <code>ONLY ONE EMAIL</code> not two!!! In email i want to write some statistics about question. But i need only ONE EMAIL! how can i possible do it ?</p>
  
  <p>thank you!</p>
  
  <p>------------------UPD-----------------</p>
  
  <pre><code>model/notifier.rb
    def deadline_notification(inquiry, user, question, respondent)
       recipients   user.email
       from         "hey@hey.com"
       subject      "Finished"
       content_type "text/html"
       body(:question =&gt; question.text, :respondent =&gt; respondent.email)
    end
  
  model/inquiry
  
  class Inquiry &lt; ActiveRecord::Base
    belongs_to  :question
    belongs_to  :respondent
    has_one     :answer, :dependent =&gt; :destroy
  
  model/question
  
  class Question &lt; ActiveRecord::Base
    has_many :inquiries, :dependent =&gt; :destroy
    has_many :answers, :through =&gt; :inquiries, :dependent =&gt; :destroy
    belongs_to :user
  end
  
  model/respondent
  
  class Respondent &lt; ActiveRecord::Base 
    has_many    :inquiries, :dependent =&gt; :destroy
    has_many    :questions, :through =&gt; :inquiries
    belongs_to  :user
  end
  
  model/user
  
  class User &lt; ActiveRecord::Base
    has_many :questions
    has_many :respondents
  </code></pre>
  
  <p>TODO: find all inquries where is_answered = 0 (For example i have 100 respondents, and 70 people are answered) and send ME email (user, who added question ok, (it is working)) that 70 respondents answered (AND WHO EXACTLY) and who not answered. JUST SEND ONE EMAIL!</p>
  
  <p>PS - Now i received 30 emails (who are not answered), but i think it is wrong :D</p>