Hello! The many answers of this question are not appropriated for me. What is the BIG difference between form_for and form_tag? In several web pages, i read like below... form_for method is used for specificated wrapped model object, and form_tag is just output the <form> tag. It''s not clear to me... Isn''t it equal that source using form_for or form_tag? Please, any feedback to me. Thanks! Rucy. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jamal Soueidan
2007-Sep-09 08:39 UTC
Re: What is difference between form_for and form_tag?
You would use form_for for a specific model when you want to create a
new row, like this
<% form_for :person, @person, :url => { :action => "update" }
do |f| %>
then in here you can use the f object to create input field.
First name: <%= f.text_field :first_name %>
Last name : <%= f.text_field :last_name %>
Biography : <%= f.text_area :biography %>
<% end %>
Form_tag create basically just <form ...></form>, can be used to
create
multi form or whatever speciale thing you want to create.
<% form_tag ''/posts'' do -%>
<%= text_field_tag "post", "first_name" %>
<% end -%>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---