instance variable vs. symbol in ruby on rails (form_for)

Solution 1:

if you use symbol :post it creates

<form action="/posts" method="post">

if you use the instance @post

for @post = Post.new you will get

<form action="/posts/create" class="new_account" id="new_account" method="post">

for @post = Post.find(1) you will get

<form action="/posts/update" class="edit_account" id="edit_account_1" method="post">
<input name="_method" type="hidden" value="put">

if you have different forms for your new and your edit no big deal but more likey than not your new and your edit forms are going to be identical or close to it

so if you use the instance variable @post you can put all the form code into _form and just call the partial and it will handle the rest based on if you pass in a new record or an existing record

Solution 2:

One possible reason is that it makes the code for the form to create a new post more similar to the code for a form to update an existing post.