ruby on rails - looping through images and displaying associated image details -
i have edit page (for car model) loops through list of images , display description associated each image in text field user can edit it.
my problem each image, instead of displaying associated description, descriptions associated car (and not particular image) displayed each particular image. e.g, if have editing car details , car has 3 images, each having description. 3 descriptions displayed each image, resulting in 9 descriptions field in on edit page.
<% @car.images.each | image | %> <div class="car_photos"> <%= image_tag(image.data.url(:thumb), :alt => '') %> <% f.fields_for :images |builder| %> <%= render "imageedit", :f => builder %> <% end %> </div> <% end unless @car.images.first.new_record? rescue nil %> _imageedit.html.erb:
<% f.fields_for :descriptions |builder| %> <p>description:<%= builder.text_area :desc %></p> <% end %> any suggesion on how solve prob? thanks
either
<% f.fields_for :images, image |builder| %> or
<% f.fields_for image |builder| %>
Comments
Post a Comment