Forum: Ruby on Rails How to use UploadColumn

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Aed326335b876b6baf65016450c00cfa?d=identicon&s=25 Mister Yu (Guest)
on 2007-07-19 02:42
(Received via mailing list)

I installed the plugin, but got stuck rewriting the view, from the
homepage, it says:

If you want the actual file to be sent you need to set the encoding of
the form to multipart. There is a convenient method in UploadColumn
that makes this really easy, instead of your usual form_tag
declaration simply use upload_form_tag.

but how exactly to change it? i m a newbie for ROR.

my partial form looks like this, can someone help me to rewrite it?

<%= error_messages_for :user %>
<% form_for :user do |f| -%>
<p><label for="login">Login</label><br/>
<%= f.text_field :login %></p>

<p><label for="email">Email</label><br/>
<%= f.text_field :email %></p>

<p><label for="password">Password</label><br/>
<%= f.password_field :password %></p>

<p><label for="password_confirmation">Confirm Password</label><br/>
<%= f.password_field :password_confirmation %></p>

    <label for="avatar">Upload A Mugshot:</label>
    <%= f.file_field :avatar %>

<p><%= submit_tag 'Sign up' %></p>
<% end -%>
6c469749d725177dd2837d806c769cd4?d=identicon&s=25 JN_Coward (Guest)
on 2007-07-19 06:37
(Received via mailing list)

there is no helper for form_for in UploadColumn yet, it'll be in the
next version, till then you can replace

<% form_for :user do |f| -%>


<% form_for( :user, :html => { :multipart => true }) do |f| %>

that should do the trick, ugly though it is.

This topic is locked and can not be replied to.