Form_for yags questions


#1

Hi have a question about several tags, I do not understand if they are
RoR tags os something else

this is my form, I wrote it following the book “Simply Rails 2” in
chapter 6:

<% form_for @contacto do |f| %>

Your N.:
<%= f.text_field :name, :size => 25 %>

Your email:
<%= f.text_field :email, :size => 25 %>

Message:
<%= f.text_area :body, :rows => 10, :cols => 30 %>

<%= submit_tag 'Submit' %>

<% end %>

This is another form I found on “open source social network - from the
apress book”

<%= error_messages_for :page %>

<% form_for :page, :url => pages_url, :html => { :method => :post } do
|f| -%>

Title:
<%= f.text_field :title, :size => 60 %>

Body:
<%= f.text_area :body, :rows => 20, :cols => 60 %>

<%= submit_tag 'Save' %> or <%= link_to 'cancel', pages_url %> <% end -%>

questions:

  • is “error_messages_for” a RoR reserved statement?
  • in this expression “:url => pages_url”, where does pages_url come
    from?
  • in this expression ":html => { :method => :post } " why o I need
    a post?
  • what is the difference between using “@contacto” and “:contacto”,
    in form_for. <% form_for @contacto … or <% form_for :contacto