Topic: act_as_authenticated form problem

Hi all. I have "Nfo" model (i want to upload .nfo files) and when i have a view form created with tag "form_for":

<% form_for :nfo, :url => { :action => 'create' }, :html => { :multipart => true } do |f| %>
  <%= f.file_field :uploaded_data %>
  <%= submit_tag "Create" %></p>
<% end -%>

- it works. File is uploaded.
But i need it to work with "form_tag" like this:
<% form_tag :url => { :action => 'create' }, :html => { :multipart => true } do %>
  <%= file_field 'nfo','uploaded_data' %>
  <%= submit_tag "Create" %>
<% end -%>

With this code it doesn't work. It gives me no error, it's just like page reload but don't save anything.
Please help me with this. Thnx.

Re: act_as_authenticated form problem

First, why are you saying "do" in the form_tag? Why would you even need to do it this way?

As for why it's not saving, you'd have to post the controller, where it's doing the saving, for us to guess at that.

BJ Clark
the science department
http://www.scidept.com/

Re: act_as_authenticated form problem

I am new in rails, so i make mistakes.
That "do" was there, because after scaffolding, the default syntax for new.rhtml is

<% form_tag :action => 'create' do %>
  <%= render :partial => 'form' %>
  <%= submit_tag "Create" %>
<% end %>

I deleted that render and put in the file_field (just for test it without partial).
But the problem wasn't with that "do". It was in missing brackets () and now it works. smile
The correct syntax is:
<%= form_tag({:action => 'create'}, {:multipart => true}) %>
  <%= file_field 'nfo','uploaded_data'  %></p>
  <%= submit_tag "Create" %>
<%= end_form_tag %>

Anyway, thanks for your help. I appreciate that.