In my \_form.html.erb file, I have;

```
<%= form_for(@document) do |f| %> 
<% end %>

```

When I add

```
<%= form_for(@document), :remote => true do |f| %> 
<% end %>

```

I get an error. I want to add ajax to this form so the user can submit it, it'll appear with a notice saving "saved" and then the user can carry on writing in the textarea within the form.

The error says:

```
SyntaxError in Documents#edit

Showing /app/views/documents/_form.html.erb where line #1 raised:

<%= form_for(@document), :remote => true do |f| %>

```

It's saying that line 1 (above) is a syntax error.

How can I add remote true to the form\_for so I can add Ajax?

### Update

So out of the two answers, I have;

```
<%= form_for(@document, :remote => true) do |f| %>

```

and

```
<%= form_for @document, :remote => true do |f| %>

```

They both work but is one better than the other or do they end up doing the same thing?