title: Rails 3.2 create a form that's used in the footer of every page
body: <p>I want to create a form that's used to sign up to a mailing list in the footer of my webpage.
  What I did was create a partial that renders this small form in the footer of the application layout.</p>
  
  <p>Here is the code for the partial:</p>
  
  <pre><code>&lt;%= form_for(@mailing_list) do |f| %&gt;
    &lt;% if @mailing_list.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(@mailing_list.errors.count, "error") %&gt; prohibited this mailing_list from being saved:&lt;/h2&gt;
  
        &lt;ul&gt;
        &lt;% @mailing_list.errors.full_messages.each do |msg| %&gt;
          &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
        &lt;% end %&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label :first_name %&gt;&lt;br /&gt;
      &lt;%= f.text_field :first_name %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :last_name %&gt;&lt;br /&gt;
      &lt;%= f.text_field :last_name %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :email %&gt;&lt;br /&gt;
      &lt;%= f.text_field :email %&gt;
    &lt;/div&gt;
    &lt;div class="actions"&gt;
      &lt;%= f.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I'm still learning rails so that's generated code from scaffolding. From what I gather I need to instantiate the @mailing_list variable with @mailing_list = MailingList.new but the problem here is that NEW action in the mailing list controller doesn't get called because I'm not necessarily visiting that page. This form is in the footer of every page.</p>
  
  <p>What would be the proper way to create this form? 
  Is there a way to do this without calling MailingList.new in every controller?</p>
  
  <p>Thanks!</p>