rubyonrailsin

A Ruby and Rails talk

Tuesday, March 30, 2010


[Rails] object with many paperclip photos

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

I have an object that has multiple photos uploaded to it, using the
paperclip plugin. I used a virtual attribute to have mutliple photos
in the form but I can't figure out how to get the image to save. It
works if I put <%= photo_form.file_field :image_file_name %> instead
of just :image. If I use just the following, the image_file_name
field is blank when it is saved.

<% for photo in @analysis.photos %>
<% fields_for "analysis[photo_attributes][]", photo do |photo_form|
%>
<p>
image description: <%= photo_form.text_field :description %>
<%= photo_form.file_field :image %>
</p>
<% end %>
<% end %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive