Why instead of a symbol?

Trying to break Rails code more, so I can understand what is going on

<%= form_for :article do |f| %>
  <p>
    <%= f.label :title %><br>
    <%= f.text_field :title %>
  </p>

 <p>
    <%= f.label :text %><br>
    <%= f.text_area :text %>
 </p>

 <p>
   <%= f.submit %>
  </p>
<% end %>

This code refers to section 5.2 of the ribs section: http://edgeguides.rubyonrails.org/getting_started.html

 <%= form_for :article do |f| %>

This line bothers me. Why is it a symbol instead of @article?

@article will be an instance of the Article object, right? And do you want this for form_for?

ps. Feel free to edit the title to reflect this post more.

EDIT ... I understand why this post is marked as a duplicate, and I'm fine, letting it stand.

. , (.. ) , Rails 4, (: article) (@article) - .

: First argument in form cannot contain nil or be empty

, , :

 <%= form_for @article do |f| %>

, - . , , , . , , @ .

, , , ?

+3
1

, , :

form_for, . : . form_for , . FormBuilder - f - , . , f .

. HTML- , , /articles/new. , , , .

URL-, . : url form_for. Rails , "create", .

TL;DR

form_for(@article || Article.new) do |f|

+1

All Articles