Looking for a bit of help

Hi All,

I thought Id try out this group

Here’s where I’m at:

has_many :photos

belongs_to :tour

Here is my edit view (Im using HAML)

= semantic_form_for @tour , :html => {:multipart => true} do |f|
= f.inputs

- unless @tour.new_record?
= semantic_fields_for Photo.new do |f|
= f.file_field :image, :rel => tour_photos_path(@tour)

= render :partial => 'photos/photo', :collection => @tour.photos

= f.buttons

Here is the partial that is rendered when an image is uploaded:

= image_tag photo.image_url(:small_thumb) if photo.image?
= button_link_to “Delete”, tour_photo_path(@tour, photo), :method =>
:delete, :confirm => “Are you sure?”, :remote => :true

Some how I need to get something like this into the returned partial:

= semantic_form_for @tour.photo do |f|
= f.text_field :description

I need to be able to edit a field on the uploaded images (once they have
uploaded) (the description field)

But I can’t figure it out

Anyone have any clues where Im going wrong?

Thanks for your help,


On Oct 9, 3:22am, Jonny D. [email protected] wrote:

belongs_to :tour

Sounds like you should look at accepts_nested_attributes_for - it’s
designed to make it easy to edit/create related objects within a
single form.