title: Invoke action to send email in ruby on rails
body: <p>I am attempting to send an email to the present borrower of a book. I've created an ActionMailer called ReturnRequestMailer which has a method called please_return.</p>
  
  <pre><code>class ReturnRequestMailer &lt; ActionMailer::Base
    def please_return(book_loan)
      subject    'Book Return Request'
      recipients book_loan.person.email
      from       'andrew.steele@west.cmu.edu'
      sent_on    Time.now
  
      body       :book_loan =&gt; book_loan
    end
  end
  </code></pre>
  
  <p>I am attempting to call this method from an action inside of my BooksController</p>
  
  <pre><code>def request_return
    @book = Book.find(params[:id])
    ReturnRequestMailer.please_return(@book.current_loan)
  end
  </code></pre>
  
  <p>Which I invoke from my books index with the following link_to (ignoring for the time being that doing this in this manner probably isn't the smartest permanent solution).</p>
  
  <pre><code>&lt;%= link_to 'Request Return', {:action =&gt; 'request_return' , :id =&gt; book} %&gt;
  </code></pre>
  
  <p>Everything links up correctly but I get a NoMethodError in BooksController#request_return stating that it cannot find the method please_return for ReturnRequestMailer. What is going on that is preventing the please_return method from being visible to the BooksController?</p>