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 %>
<%= text_field :contact, :first_name %>
<%= text_field :contact, :last_name %>
<%= text_field :contact, :subject %>
<%= text_area :contact, :body, :rows => 10 %>
<%= text_field :contact, :email %>
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