Filecolumn in Edit View - restful form - Update existing Image

I generated code with ruby script/generate scaffold_resource

Whenever I go to edit an image in filecolumn it creates a whole new record with the new image, as opposed to overwriting the image.

My Question is about the second block of code. How can I pass the ID so that I can update the record instead of creating a duplicate with a different image?

Here is my code.

Create View (works fine): <h2>New kellymadison</h2>

<%= error_messages_for :km %>

<% form_for(:km, :url => kms_path,                       :html => { :multipart => true }) do |f| -%>   <p>     <label for="Title">Title:</label>     <%= f.text_field :title %>   </p>   <p>     <label for="Description">Description:</label>     <%= f.text_area :description %>   </p>   <p>     <label for="wmv">URL for WMV:</label>     <%= f.text_field :wmv_link %>   </p>     <p>     <label for="wmv">URL for MOV:</label>     <%= f.text_field :mov_link %>   </p>   <p>     <%= file_column_field "km", "image" %>   </p>   <p>     <%= submit_tag 'Create' %>   </p> <% end -%>

<%= link_to image_tag("/images/back.gif"), km_path, :class => 'back- btn' %>

Edit View (The VIEW I AM HAVING TROUBLE WITH. It creates a new record witha new ID)

<h2>Edit km</h2>

<%= error_messages_for :km %> <% form_for(:km, :url => km_path,                       :html => { :multipart => true }) do |f| -%>    <p>     <label for="Title">Title:</label>     <%= f.text_field :title %>   </p>   <p>     <label for="Description">Description:</label>     <%= f.text_area :description %>   </p>   <p>     <label for="wmv">URL for WMV:</label>     <%= f.text_field :wmv_link %>   </p>     <p>     <label for="wmv">URL for MOV:</label>     <%= f.text_field :mov_link %>   </p>     <p>      <% @km = Km.find(params[:id]) %>     <%= file_column_field "km", "image" %>   </p>   <p>     <%= submit_tag "Update" %>   </p> <% end %>

Please let me know if you find a solution.