Contact us form (n00b)


#1

Im at a loss…and its something with my routes…

i have an index.html.erb that generates a partial

<% page_title(“Contact Us”) %>

<% content_for :banner do %>
<%= render :partial => ‘contacts/banner’ %>
<% end %>

<%= render :partial => ‘contacts/form’ %>

The partial in the contacts directory _form.html.erb

<% form_tag :action => “contacts_mailer” do %>

<%= label :contact, :first_name, "First Name" %>
<%= text_field :contact, :first_name %>
<%= label :contact, :last_name, "Last Name" %>
<%= text_field :contact, :last_name %>
<%= label :contact, :subject, "Subject" %>
<%= text_field :contact, :subject %>
<%= label :contact, :body, "Message" %>
<%= text_area :contact, :body, :rows => 10 %>
<%= label :contact, :email, "Email Address" %>
<%= text_field :contact, :email %>
<%= submit_tag 'Send Request', :class => "btn" %> <%= submit_tag 'Clear Form', :class => 'btn', :type => 'reset' %>
<% end %>

and i have a contacts_controller with the following

class ContactsController < ApplicationController

def index

end

def contacts_mailer
ApplicationMailer.deliver_contact_mailer(params[:contact])
flash[:notice] = “Your Message has been sent.”
redirect_to home_path
end

end

And i have the ApplicationMailer setup according to a dozen tutorials.

the problem comes with the form action.
i have called
<% form_tag :action => “contacts_mailer” do %>
<% form_tag :controller => “contacts”, :action => “contacts_mailer” do
%>

and in the source it shows

and i do have these in the routes

map.contact_mailer ‘contact-us’, :controller => “contacts”, :action
=> “contact_mailer”
map.contact ‘contact-us’, :controller => “contacts”, :action =>
“index”

I im getting this error

Showing app/views/contacts/_whistle.html.erb where line #1 raised:

No route matches {:action=>“contacts_mailer”}

ive even created a contacts_mailer.html.erb but no dice.

any help would be awesome

thanks

Bob