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):
New kellymadison
<%= error_messages_for :km %>
<% form_for(:km, :url => kms_path,
:html => { :multipart => true }) do |f| -%>
Title: <%= f.text_field :title %>
Description: <%= f.text_area :description %>
URL for WMV: <%= f.text_field :wmv_link %>
URL for MOV: <%= f.text_field :mov_link %>
<%= file_column_field "km", "image" %>
<%= submit_tag 'Create' %>
<% 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)
Edit km
<%= error_messages_for :km %>
<% form_for(:km, :url => km_path,
:html => { :multipart => true }) do |f| -%>
Title: <%= f.text_field :title %>
Description: <%= f.text_area :description %>
URL for WMV: <%= f.text_field :wmv_link %>
URL for MOV: <%= f.text_field :mov_link %>
<% @km = Km.find(params[:id]) %> <%= file_column_field "km", "image" %>
<%= submit_tag "Update" %>
<% end %>