Form helper not working


#1

I was looking on http://guides.rubyonrails.org/v5.0/form_helpers.html

This example works fine

<%= form_tag("/search", method: "get") do %>
  <%= label_tag(:q, "Search for:") %>
  <%= text_field_tag(:q) %>
  <%= submit_tag("Search") %>
<% end %>

But I can’t get this example to work

form_tag({controller: “people”, action: “search”}, method: “get”, class: “nifty_form”)

But when try that in my erb file, I get this in my html

form_tag(controller: “people”, action: “search”, method: “get”, class: “nifty_form”)

which is clearly not valid html.

Also, should my controller be called person or people? I thought the controller should be singular and the table will be plural. Yet it has controller as plural.


#2

ah, I got it now…

the form_tag requires <%=… %> around it

controllers are plural and models are singular.


#3

This topic is solved.