Ruby on Rails : symbol as argument in form_for

Using the symbol will generate:

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

Using the object @user set to new you get:

<form action="/users" class="new_user" id="new_user" method="post">

If you set @user to something else it will change the form tag generated, of course
… try it out for yourself.

In the end it all depends what you’re trying to do. You might want to use the symbol if you have multiple :user forms on the same page.

Leave a Comment