I have a page in pages#show. I created a messages form inside that page. When submitted I get this error “Routing Error No route matches [POST] /pages/9”.
So it’s a form inside another’s model show page. In this case it’s a form that will work with the Message model, inside a Page show view.
<%= form_for(@message, :url => page_path(@page)) do |f| %>
<div class="field">
<%= f.label :content %><br />
<%= f.text_area :content %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
This is not exactly what I wanted, but it’ll do for now:
http://matharvard.ca/posts/2011/aug/22/contact-form-in-rails-3/