title: receiving email to my gmail account using actionmailer
body: <p>Please forgive the newbie question. I'm building a form that has a contact us page, in which a user should be able to fill out a form (user_full_name, user_email, subject, message), which when submitted should be sent as an email to my gmail address. I'm currently getting the following error when I try to access the view with the form on it.</p>
  
  <p>undefined method `feedbacks_path' for #&lt;#:0x007f8fefecd020></p>
  
  <p>below is my code, does anyone know what I'm doing wrong here? If possible I'd rather change the routes than add a url to the form. Also, want to use a 'match' in the routes to have the url path be 'localhost/contact' instead of 'localhost/feedback'. Does anyone have any ideas?</p>
  
  <p>routes.rb</p>
  
  <pre><code>Sample::Application.routes.draw do
  
    resources :feedback, only: [:new, :create]
  
    root to: "home#index"
    match '/about',   to: 'static_pages#about',   via: 'get'
    match '/help',    to: 'static_pages#help',    via: 'get'
    match '/privacy_policy', to: 'static_pages#privacy_policy', via: 'get' 
    match '/terms_and_conditions',   to: 'static_pages#terms_and_conditions',   via: 'get'
  end
  </code></pre>
  
  <p>Feedback_Controller.rb</p>
  
  <pre><code>class FeedbackController &lt; ApplicationController
  
    def new
      @feedback = Feedback.new
    end
  
    def create
      @feedback = Feedback.new(params[:feedback])
  
      if @feedback.valid?
        FeedbackMailer.new_feedback(@feedback).deliver
        flash[:success] = "We have receieved your message!"
        redirect_to users_path
      else
        flash.now.alert = "Please fill in all fields."
        render :new
      end
    end
  end
  </code></pre>
  
  <p>Feedback.rb</p>
  
  <pre><code>class Feedback &lt; ActiveRecord::Base
    def self.columns() @columns ||= []; end
  
    def self.column(name, sql_type = nil, default = nil, null = true)
      columns &lt;&lt; ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
    end
  
    column :user_full_name, :string
    column :user_email, :string
    column :subject, :text
    column :body, :text
  
    belongs_to :user
  end
  </code></pre>
  
  <p>view/feedback.new.html.erb</p>
  
  <pre><code>&lt;div class="feedback"&gt;
    &lt;div class="container"&gt;
      &lt;%= form_for @feedback do |f| %&gt;
  
        &lt;%= f.hidden_field :user_full_name %&gt;
        &lt;%= f.hidden_field :user_email %&gt;
  
        &lt;%= f.label :subject %&gt;
        &lt;%= f.text_field :subject %&gt;
  
        &lt;%= f.label :feedback %&gt;
        &lt;%= f.text_area :body %&gt;
  
        &lt;%= f.submit "Send", class: "btn btn-inverse" %&gt;
      &lt;% end %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>feedback_mailer</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta content='text/html; charset=UTF-8' http-equiv='Content-Type' /&gt;
    &lt;/head&gt;
    &lt;body&gt;
      Name: &lt;%= @feedback.user_full_name %&gt;
  
      Email: &lt;%= @feedback.user_email %&gt;
  
      Subject: &lt;%= @feedback.subject %&gt;
  
      Comments/Question: &lt;%= @feedback.body %&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>feedback_mailer.rb</p>
  
  <pre><code>class FeedbackMailer &lt; ActionMailer::Base
    default to:   "railstraining09@gmail.com"
  
    def new_feedback(feedback)
      @feedback = feedback
      mail(from: @user.email, subject: 'feedback.subject')
    end
  
  end
  </code></pre>