I am reading the guide on form helpers http://guides.rubyonrails.org/form_helpers.html but I'm not sure whether I actually need to write my webpages this way..
I have an HTML form like this written in new.html.erb
<form action="/posts" method="post">
<label for="title">Test</label>
<input id="title"/>
<input type="submit" value="submit"/>
</form>
(The posts
page is from the Getting Started guide)
When I submit the request, the server throws an ActionController::InvalidAuthenticityToken
exception.
So I changed it to
<%= form_for :post, url: {action: "create"} do |f| %>
<label for="title">Test</label>
<input id="title"/>
<input type="submit" value="submit"/>
<% end %>
And now I have the same form, except the server now accepts the request.
Are form helpers the proper way to develop forms in Rails views?