Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


_form.html.erb (project)

1
2
3
4
5
6
7
<% form_for @project, :html => {:multipart => true} do |f| %>
<div id="photos">
    <%= render :partial => 'photo', :collection => @project.photos %>
</div>
<%= f.submit %>
<% end %>

_photo.html.erb (project)

1
2
3
4
5
6
7
8
9
10
11
<div class="photo">
<table margin="0" padding="0">
<% fields_for "project[photo_attributes][]", photo do |p| %>
  <tr>
    <td width="161"><%= p.label :data, "Afbeelding" %></td>
    <td><%= p.file_field :data, :index => nil %></td>
  </tr>
</table>
<% end %>
</div>

photo model

1
2
3
4
5
6
7
8
9
10
11
class Photo < ActiveRecord::Base
 belongs_to :project

   has_attached_file :data, :styles => {:thumb => "150x112>", :original => "500x400>" }, 
                  :url  => "/images/projects/:id/:style/:basename.:extension",
                  :path => ":rails_root/public/images/projects/:id/:style/:basename.:extension",
                  :default_url => "/images/no_image.gif"


end

update.html.erb (update action is disabled for testing)

1
2
3
4
I've already tried 
<%= debug(params[:project][:photo_attributes] )%>
But this returns 
[{"data"=>#<File:/var/folders/id/idbDI59EHRyIehAeMr-wtE+++TI/-Tmp-/RackMultipart20091204-392-1klw6yd-0>}]