Forum: Ruby on Rails form_for yags questions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Pepe S. (Guest)
on 2008-10-11 02:59
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| %>
<p><label>Your N.:<br /><%= f.text_field :name, :size => 25
%></label></p>
<p><label>Your email:<br /> <%= f.text_field :email, :size => 25
%></label></p>
<p><label>Message:<br /><%= f.text_area :body, :rows => 10, :cols => 30
%></label></p>
<p><label><%= submit_tag 'Submit'   %> </label></p>
<% 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| -%>
  <p>Title:<br /><%= f.text_field :title, :size => 60 %></p>
  <p>Body:<br /><%= f.text_area :body, :rows => 20, :cols => 60 %></p>
  <%= 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
This topic is locked and can not be replied to.