Problems with form_for(@message.attachments.build ...)


#1

Hi, I’m puzzled by the next.

I have messages that have attachments.
I have an index action for the attachments where I list all the
attachments that a message has. From the same index page I can also add
new attachments to that message.

For that I’ve been using the next form

<% form_for(@message.attachments.build, :html => { :multipart => true })
do |f| %>
<%= hidden_field_tag ‘mess’, @message.id %>

Attachment: <%= f.file_field :uploaded_data, :size => "20" %>

<%= submit_tag('Attach', { :class => "bigButton" }) %> <% end %>

In my local environment (upgraded now to Rails 2.3.2, I originally did
this in Rails 2.1.2) that sends a request to the Create method of the
attachments controller as expected.

However in the real server (Rails 2.1.2) the same sends a request to the
Index method of the attachments controller.

Anyone sees a reason why it goes to the Index method in the real server?
Maybe something is different in those versions (?)

Thanks.


#2

Hi,

Fixed thanks to a suggestion from:
http://railsforum.com/viewtopic.php?id=28784

Cheers.