schroedi schrieb:
Dachte das wäre ohnehin klar gewesen, wenn es fast der gleiche Code ist
wie vom Railscast


hier das Model:
class Newsteam < ActiveRecord::Base
has_attached_file :photo, :styles => { :small => "150x150>" },
                    :url  =>
"/photos/newsteam/:id/:style/:basename.:extension",
                    :path =>
":rails_root/public/:attachment/:id/:style/:basename.:extension"

  #validates_attachment_presence :photo
  validates_attachment_size :photo, :less_than => 5.megabytes
  validates_attachment_content_type :photo, :content_type =>
['image/jpeg','image/jpg', 'image/png']
end

new View
<% form_for(@newsteam) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :vorname %><br />
    <%= f.text_field :vorname %>
  </p>
  <p>
    <%= f.label :nachname %><br />
    <%= f.text_field :nachname %>
  </p>
  <p>
    <%= f.label :ort %><br />
    <%= f.text_field :ort %>
  </p>

  <p>
    <%= f.label :Foto %><br />
    <%= render :partial => 'form', :locals => { :f => f } %>
  </p>
    <%= f.submit 'Create' %>
<% end %>

_form Partial
<% form_for @newsteam, :html => { :multipart => true } do |f| %>
<%= f.error_messages %>
  <%= f.file_field :photo %> <%= f.submit "upload" %>
<% end %>

das hat Ryan aber so nicht gemacht und dürfte der Grund sein.
Das file_field gehört direkt ins erste Formular - und dieses mit
multipart-Funktionalität ausgestattet.

Ob verschachtelte Formulare überhaupt HTML-konform sind?

Torsten
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/listinfo/rubyonrails-ug

Antwort per Email an