title: Rails method that handles ajax complaining about no template?
body: <p>I have a <code>subscriber#create</code> method that is only used for ajax submits to it (the html form uses <code>data-remote="true"</code> to do the Ajax. The form does indeed submit and the data ends up in the db but the method throws an error saying that the template was not found.</p>
  
  <p><strong>How can I specify a function as being an Ajax handler in Rails?</strong> -- one that doesn't have to render a template, etc.</p>
  
  <p>Here is what the method looks like:</p>
  
  <pre><code>class SubscribersController &lt; ApplicationController
  
    def create
      Subscriber.create(:email          =&gt; params[:email],
                        :ip_address     =&gt; request.remote_ip,
                        :referring_page =&gt; request.referer ) unless Subscriber.find_by_email(params[:email])
    end
  
  end
  </code></pre>