Acts_as_attachment Editing Images

I am currently using acts_as_attachment to upload multiple images in a
form. I can currently edit all the info in the form but not the images
associated with each record. How would I go about doing this?

Equipment has_many :images
Image belongs_to :equipment

My Controller Looks Like This:

def new
@equipment = Equipment.new
@image1 = Image.new
@image2 = Image.new
@image3 = Image.new
@image4 = Image.new
end

def create
@equipment = Equipment.new(params[:equipment])
@image = @equipment.images.build(params[:image1])
@image = @equipment.images.build(params[:image2])
@image = @equipment.images.build(params[:image3])
@image = @equipment.images.build(params[:image4])
if @equipment.save
flash[:notice] = ‘Equipment was successfully created.’
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end

My New Equipment Form is set up like this:

<%= error_messages_for :equipment %>
<%= error_messages_for :image %>

New equipment

<% form_tag ({:action => ‘create’}, :multipart=> true) do %>

Category
<%= select :equipment, :category, ['Choice 1', 'Choice 2', 'Choice 3' ] %>

Year
<%= select :equipment, :year, ['Choice 1', 'Choice 2', 'Choice 3' ] %>

Make
<%= select :equipment, :make, [ 'Choice 1', 'Choice 2', 'Choice 3' ] %>

Model
<%= text_field 'equipment', 'model' %>

Serial Number
<%= text_field 'equipment', 'serial_number' %>

Hours
<%= text_field 'equipment', 'hours' %>

Price
<%= text_field 'equipment', 'price' %>

Description
<%= text_area 'equipment', 'description', "rows" => 7, "cols" => 23 %>

Upload Image 1
<%= file_field :image1, :uploaded_data %>

Upload Image 2
<%= file_field :image2, :uploaded_data %>

Upload Image 3
<%= file_field :image3, :uploaded_data %>

Upload Image 4
<%= file_field :image4, :uploaded_data %>

Status
<%= select :equipment, :status, ['For Sale', 'Sold'] %>

<%= submit_tag “Create” %>
<% end %>

<%= link_to ‘Back’, :action => ‘list’ %>

Uploading images when creating a new record works flawlessly but as
stated I can not get the edit function to work for the images. Any
help would be appreciated.

Thanks,

I am also having the same problem. Apparently there is no method for
updating an attachment record. How can I get around this? Here is what
I have:

==VIEW==

<%= file_field “image”, “uploaded_data” %>

==CONTROLLER==

unless params[:image][:uploaded_data].blank?
image = @person.images(0)
image.update_attributes(params[:image])
end

==ERROR==

NoMethodError in PeopleController#edit
undefined method `update_attributes’ for Image:Class

I have been looking at Mephisto and they use acts_as_attachment to
manage assets. It also has the ability to edit any files you upload
and write over them. Does anyone know how this is done?

On Mar 20, 11:12 am, Taylor S. [email protected]