It is used for a particular model and it is a object dependent form
<% form_for(:name, @name, :url => path, :html { } do|f| %>
<%= f.text_field :name %>
<%= f.password_field :password %>
<% end %>
In the above "form_for" tag ":name" is model name , "@name" is object which is created to access the record , url => path(specify the path here) , :html { } this is the optional attribute in this we can specify the method based on REST . In the
form_tag is the normal tag which is used for normal fields means the fields which are not based on the model and the database .
for example
if we need a search field then we go with form_tag.
<% form_tag '/name' do -%>
<%= text_field_tag "name", "username" %>
<% end %>










0 comments: