Looking for a bit of help

Hi All,

I thought Id try out this group

Here’s where I’m at:

Tour
has_many :photos

Photo
belongs_to :tour

Here is my edit view (Im using HAML)

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

#photos
- 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:

.photo[photo]
.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,

Jonny

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.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs