attachment_fu and form_tag for multiple models?

hi, i've got a page where i'm trying to save the user's profile
information and an image of the user, but i'm having trouble with using
attachment_fu and the form_tag method.

now i know attachment_fu isn't designed for form_tag but am really
hoping someone has a solution for this as frankly i'm stumped.

here's the form_tag part in the view...

<% form_tag( { :action => "add_profile" }, { :multipart => true }) do %>

<%= file_field_tag 'image', :uploaded_data %>

<%= text_area :profile, :body, :cols => 25, :rows => 6 %>

<%= submit_tag 'Submit' %>

<% end -%>

and in the add_profile method...

def add_profile
return unless request.post?

@image = Image.new(params[:image])
@image.user_id = self.current_user.id
@image.default = true #set it to be the default photo for the user

@profile = Profile.find(self.current_user.id)
@profile.update_attributes(params[:profile])
redirect_to :action => 'profile'
end

looks like it should work and the profile part is being saved but no
image is being uploaded.

any ideas?

Try saving the @image instance.

ugh, thanks Rick,

added a save method and it worked fine.

i changed the filetag to...

<%= file_field :image, :uploaded_data %>

and in the controller added the save call..

@image.save

:wink: