title: Contact Me Form for One Page Layout
body: <p>I am in the process of creating a Contact Me form on a one page layout. I have most of the code setup but cannot seem to resolve an error that appears. I will place all the code with the error below. Note: I haven't setup the mailer yet, I was going to do that once this code was properly setup :)</p>
  
  <pre><code>#routes
  Rails.application.routes.draw do
    resources :contacts, only: [:new, :create]
    devise_for :users
    root 'welcome#index'
  end
  
  #form
  &lt;%= form_for @contact do |x| %&gt;
    &lt;div class="field"&gt;
      &lt;%= x.label :name %&gt;&lt;br /&gt;
      &lt;%= x.text_field :name %&gt;
      &lt;%= x.submit %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  
  #ContactsController
  class ContactsController &lt; ApplicationController
    def new 
      @contact = Contact.new
    end
  
    def create
     @contact = Contact.new(contact_params)
     if @contact.save
        flash[:notice] = "Your message has been sent!"
        redirect_to :action =&gt; :index
     else
        flash[:notice] = "Try Again!"
     end
    end
  
    private   
     def contact_params
      params.require(:contact).permit(:name)
     end
  end
  
  #Index View
  &lt;%= render partial: 'contacts/form' %&gt;
  </code></pre>
  
  <p>The error I mostly receive is <code>First argument in form cannot contain nil or be empty</code>. I have also tried placing the <code>@contact = Contact.new</code> within the Index Action of the welcome controller, but that throws up this issue: <code>Unable to autoload constant Contact, expected .../app/mailers/contact.rb to define it</code></p>
  
  <p>If you have any suggestions, thoughts or opinions, please let me know =) Any help is greatly appreciated, thank you!</p>
  
  <p>PS: If any further code is needed or information, just ask. There is a contact model with the various columns.</p>
  
  <p><strong>Update</strong></p>
  
  <p>I now have the <code>@contact = Contact.new</code> within my Index Action of my Welcome Controller. Ultimately trying to solve the mailer issue I receive.</p>