What is the difference between form_for
and form_tag
in form construction since the end result is apparently the same?
In which situation do you choose one or the other?
What is the difference between form_for
and form_tag
in form construction since the end result is apparently the same?
In which situation do you choose one or the other?
form_for you use for a specific model, ex
<% form_for @user do |f|
<%= f.text_field :nome %>
<%= f.email_field :email %>
<%= f.submit %>
<% end %>
Form tag you use to create simple forms
<%= form_tag '/search' do %>
<%= text_field_tag "q" %>
<% end %>