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 %>
<div>
<%= label :contact, :first_name, "First Name" %><br />
<%= text_field :contact, :first_name %>
</div>
<div>
<%= label :contact, :last_name, "Last Name" %><br />
<%= text_field :contact, :last_name %>
</div>
<div>
<%= label :contact, :subject, "Subject" %><br />
<%= text_field :contact, :subject %>
</div>
<div>
<%= label :contact, :body, "Message" %><br />
<%= text_area :contact, :body, :rows => 10 %>
</div>
<div>
<%= label :contact, :email, "Email Address" %><br />
<%= text_field :contact, :email %>
</div>
<div>
<%= submit_tag 'Send Request', :class => "btn" %>
<%= submit_tag 'Clear Form', :class => 'btn', :type => 'reset' %>
</div>
<% 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 <form method="post" action="/contact-us">
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---