# Contact us form (n00b)

**URL:** <https://www.ruby-forum.com/t/contact-us-form-n00b/167851>\
**Category:** Rails\
**Created:** [May 13, 2009, 9:57am UTC](https://www.ruby-forum.com/t/contact-us-form-n00b/167851 "2009-05-13T09:57:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [May 13, 2009, 9:57am UTC](https://www.ruby-forum.com/t/contact-us-form-n00b/167851/1 "2009-05-13T09:57:33Z")

</div>

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
